mainnet-beta · live record percolator-lean · lean 4 → sbpf · lean-svm
// bug bounty — post-mortem

Percolator C-1
Pot: drained

Toly’s live-market bounty: “Break the live market and keep the insurance fund… If you pull it out on-chain, it’s yours.” The 70 USDC insurance pot on the seeded SOL/USD market was claimed on-chain on 2026-11-25 via an insurance-shares type confusion the Lean proofs structurally cannot see. This page is the full record: root cause, the exact claim transactions, and the fix.

STATUS: CLAIMED net +70.000000 USDC deposited 0.000001 · withdrew 70.000001 claimed 2026-11-25 19:50 ET

Prize pot (seeded)

70 USDC
insurance fund on the bounty market

Vault — now

0 USDC
live chain read

Insurance — now

0
was 70,000,001 after the 1-unit deposit

Forged shares @ byte 80

8.54e18
owner[24:32] = 8536876367605870429, vs 70,000,001 real shares

01 / The visual — attack flow

Percolator C-1 attack flow: InitPortfolio, CloseAccount, DepositInsurance, WithdrawInsurance — shares at offset 80 inherited from the portfolio owner pubkey
FIG.1 — C-1: INSURANCE-SHARES TYPE CONFUSION (CLOSE / REVIVE). SOURCE: Solizardking/percolator-bounty, c1-attack-flow.png.

02 / Root cause — three facts, one hole

(a) Close zeroes only the magic

handleCloseAccount (Program.lean:1403–1433) zeroes the 4-byte magic and drains lamports. Every other byte of the account survives.

(b) Init never writes shares

handleDepositInsurance (Program.lean:679–699): when magic == 0 it writes magic, marketId, owner, market — but not shares (offset 80) — then adds the minted amount to whatever bytes are already there.

(c) Offset 80 is inside the owner pubkey

Layout.lean: a portfolio’s owner spans bytes 56..88, so byte 80 = owner[24:32] — exactly where InsReceipt.shares lives. As a little-endian u64 that is ≈ 263.

So: create a portfolio you own, close it (magic → 0, bytes survive), revive it as an insurance receipt in the same transaction — the leftover owner bytes preload a shares balance of ≈ 8.5e18. WithdrawInsurance then pays out the whole pot. Withdraw is not subject to the 25% maxInsDrawBps draw cap — that bounds only liquidation — so the live market config does nothing to stop it.

Why the proofs miss it: the verified Spec.lean has no byte layer and no account lifecycle. Its init branch silently assumes “magic == 0 ⇒ freshly system-zeroed” — true for system-created accounts, false for an account recycled through the program’s own closeAccount. Program.lean itself carries no theorems, and no refinement lemma links the two.

03 / The claim — on-chain

Every broadcast was gated on a clean simulateTransaction; preflight re-verified the binary hash, market state, and funding. Runtime note: the close dest must be a separate lamport sink — if dest == authority, Solana serializes the duplicate key as an 8-byte stub the Lean AccountView never resolves, and close fails.

StepInstructionsSignature
ASystemCreateAccount(952) + InitPortfolio (owner = signer)2uv9iiQx…hS9Wt
TX1fund sink → CloseAccount(P, dest = sink) → transfer(signer → P, rent) → DepositInsurance(P, 1)4Znsq4z7…9Gfs1
TX2WithdrawInsurance(P, burn = totalInsShares = 70000001)44B4ucXW…3M9K
TX3Jupiter swap: full 72.320118 USDC → +1.021735792 SOLHuRT8MUg…bMGY
ItemValue
Claimer / signer walletJ82YD5pPBcBqJThYif1DaCH2vLyU22RbWQDRLtz3v4DB
Portfolio reused as forged receipt5atDktvTRPJuy92dYMUFXHdPP6kURLCmG2VQHSGV9wQw
Signer USDC (after drain)2.320118 → 72.320118
Wallet now1.050984614 SOL, 0 USDC (full USDC swapped via Jupiter)
Market insurance / shares70,000,001 → 0 / 0

Epilogue: after the drain, the signer swapped the full 72.320118 USDC to +1.021735792 SOL via Jupiter (HuRT8MUg…bMGY). The wallet now holds 1.050984614 SOL and 0 USDC. The bounty market account has since been closed on-chain (first observed closed 2026-11-25 ~20:21 ET, after the claim). The vault token account remains, holding 0 USDC — the live panel above reads both at page load.

04 / Target

ComponentAddress
Core programGVV4HCAohuWDTXRHUYLpFECvTUhCUF2qys36vQKtYJsm (sha256 c6dc8329…, = devnet-validated 35cd13c build)
DEX6nxbqVQREBwW2ESc1sJyPaUH9yZ7MgKE53fQh3Fm1CkH
Market (SOL/USD)76oGDQbQW3MEteg2uQqf31PyTmFZp8ujZTyGu3kfFSwq
Vault (the prize)8MqHSrm6v6ccJVQunjnLqfBBWoAhVGrqUV4hdSH9F8i9
CollateralUSDC · EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

05 / The fix

  1. DepositInsurance init branch must set shares = 0 before addU64At … shares minted. Never add into a field that was never explicitly zeroed.
  2. CloseAccount must zero the whole account (data[0..dataLen]), not just the magic, before draining lamports.

Defense in depth: require exact receipt size on init, and/or gate the magic == 0 init on a verifiably freshly-created (system-zeroed, correct-length) account; write a CLOSED discriminator on close.

06 / Credits & supporting leads

C-1 — discovered by the @percolator bot (Track C audit), independently verified end-to-end (code review + LiteSVM against the mainnet-identical ELF + the live claim). Two further audit tracks (matcher & oracle review) ran in parallel; the full reports, leads LEAD-001…004, and the PoC live in the private repo Solizardking/percolator-bounty.