Reproduced Exploit
Megapot — Unoptimized subset matches counting exceeds Base tx gas limit
_countSubsetMatches regenerates subsets for every bonusball. At bonusballMax=129 the settlement callback measures ~25.8M gas and exceeds Base's 25M per-tx limit, so Pyth cannot settle the drawing.
Chain
Other
Category
untagged
Date
Nov 2025
Source
AuditVault
EVM Playground
Source-level debugger — step opcodes and Solidity in sync
The attack is replayed in an in-browser EVM preloaded with the exact dumped fork state. The execution tree shows every call; step by Solidity line or by opcode across all depths — source, Stack, Memory, Storage, Balances (native / ERC-20 / NFT), Transient storage and Return value stay in sync. Click a tree node, opcode, or source line to jump. No backend, no live RPC.
Source & credit. Reproduction of a public audit finding curated by AuditVault — the original finding: 64141-h-02-unoptimized-subset-matches-counting-implementation-will. Standalone Foundry PoC and full write-up: 64141-h-02-unoptimized-subset-matches-counting-implementation-will_exp in the
evm-hack-registrymirror.
Reproduction: self-contained Foundry PoC (forge-std only) — no fork. Full trace: output.txt.
AuditVault taxonomy: lang/solidity · platform/code4rena · severity/high · sector/gaming · genome: gas-limit · permanent
Key info#
| Impact | HIGH — entropy callback exceeds Base 25M tx gas → drawing never settles |
| Protocol | Megapot |
| Bug class | Uncached generateSubsets inside bonusballMax × normalTiers nested loops |
| Finding | Code4rena 2025-11-megapot H-02 · #64141 |
| Report | https://code4rena.com/reports/2025-11-megapot |
| Source | AuditVault |
| Status | Audit finding — sample+extrapolate gas PoC |
| Compiler | ^0.8.24 (PoC) |
TL;DR#
_countSubsetMatches regenerates subsets for every bonusball. At bonusballMax=129 the settlement callback measures ~25.8M gas and exceeds Base's 25M per-tx limit, so Pyth cannot settle the drawing.
HARM: extrapolated settlement gas at real bonusballMax exceeds Base tx gas limit → permanent drawing DoS.
Root cause#
Uncached combinatorial subset generation inside nested settlement loops.
Preconditions#
Large pool → high bonusballMax (e.g. 129 at 16M USDC cap).
Attack walkthrough#
Sample gas at small bonusballMax, extrapolate linearly to 129, require > 25_000_000.
Diagrams#
Impact#
Drawings at high bonusballMax cannot be settled; jackpot liveness fails.
Sources#
- AuditVault finding
- Report: https://code4rena.com/reports/2025-11-megapot
- Reduced source provenance: github.com/code-423n4/2025-11-megapot@f0a7297 TicketComboTracker.sol
Sources & further analysis#
Reproductions & code
- Standalone PoC + full trace: 64141-h-02-unoptimized-subset-matches-counting-implementation-will_exp (evm-hack-registry mirror).
- AuditVault finding: 64141-h-02-unoptimized-subset-matches-counting-implementation-will.
Alerts & third-party analyses
These dashboards index community alerts tweets, post-mortems, and independent write-ups. Reach them through the protocol name above to cross-check this reproduction against other analyses.