Skip to content

[Audit] Round 7 Summary — Aggressive exploitation: Forge POCs, Codex second opinion, line-by-line traces #88

Description

@mejango

Round 7 Summary

Strategy: After Round 6 returned 0 new findings, Round 7 took a maximally aggressive approach with 7 parallel agents:

  1. Concrete Forge exploit POC writing — 11 executable attack tests
  2. Codex (OpenAI) second opinion — independent model auditing the same contracts
  3. Cross-repo assumption mismatch hunting
  4. Persona-driven attack trace construction (line-by-line)
  5. Migration & upgrade path attacks
  6. Try-catch failure path exploitation (all 28 blocks)
  7. Unchecked/invariant edge case hunting

Results: 0 new actionable findings

All investigation paths converged on the same conclusion: the protocol's defenses are sound.

Forge Exploit POC Results (11 tests)

Attack Result Why
Flash loan pay→cashOut (0% tax) FAILED Proportional math: surplus and supply increase together
Flash loan pay→cashOut (5% tax) FAILED Tax + 2.5% fee makes it worse for attacker
Flash loan with high surplus (0% tax) FAILED Proportional share = exact deposit amount
Flash loan pay→cashOut (100% tax) FAILED Returns 0 by design
Double payout same terminal FAILED usedPayoutLimitOf tracking prevents it
Double payout cross-terminal By design Independent per-terminal limits are intentional
Payout + surplus allowance race By design Independent limit types stack intentionally
Malicious data hook (same weight all users) FAILED Inflation proportional to all users
Project owner rug via data hook Succeeded Documented trust assumption — data hooks have absolute weight control
Cross-terminal cashout FAILED Local surplus used; balanceDiff > currentBalance caps reclaim
Cross-terminal with total surplus FAILED Total surplus calculation capped at local balance

The only "successful" exploit (Attack 5b) is the documented trust assumption that project owners control data hooks. Already noted in JBTerminalStore.sol security comments.

Codex (OpenAI) Second Opinion

Three independent Codex audits confirmed:

  • CEI pattern correct throughout — no reentrancy exploitable despite no explicit guards
  • No CRITICAL/HIGH findings in JBMultiTerminal, JBTerminalStore, JBController, REVLoans, JBSucker, JBBuybackHook
  • REVLoans micro-repayment fee evasion: Codex flagged mulDiv rounding in partial repayments, but verification shows it requires ~3e18 transactions per loan to exploit — gas cost exceeds fee savings by ~14 orders of magnitude. Code comment at L686 correctly acknowledges this.
  • Stale totalCollateralOf during _adjust: Confirmed transient inconsistency exists but is theoretical under standard terminal/hook trust model.

Cross-Repo Mismatch Analysis

Finding Severity Status
Custom price feed returning 0 → DoS HIGH theoretical Documented — NatSpec at JBPrices L17-21 explicitly accepts this as immutability tradeoff
Fee-on-transfer tokens fail sucker assert HIGH Out of scope — suckers explicitly document standard ERC-20 only
Terminal rejection blocks sucker claims MEDIUM Not a bug — atomic transactions roll back bitmap; claims are retryable

Fee Terminal Redirection Analysis

Thorough trace of fee flow confirmed:

  • JBFee struct has no terminal field — terminal resolved dynamically at processing time
  • Only project 1 owner (protocol governance) can change the fee terminal
  • Try/catch safety net: failed fee routing results in fee forgiveness, not stuck funds
  • Working as designed

Sucker Claim Blocking Analysis

Full trace of claim()_validate()_handleClaim()_addToBalance() confirmed:

  • Bitmap set and terminal call are in same atomic transaction
  • If addToBalanceOf reverts, entire claim reverts including bitmap — claims are retryable
  • Terminal lookup is dynamic (not cached at bridge time) — terminal migration is safe
  • Emergency hatch uses separate bitmap slot — no cross-contamination
  • No fund loss possible

Try-Catch Analysis (28 blocks)

All 28 try/catch blocks across the codebase follow fail-safe patterns:

  • Split hook revert → funds returned to project (conservative)
  • Buyback swap failure → fallback to mint (conservative)
  • Fee processing failure → fee forgiven to project (conservative)
  • Approval hook revert → returns Failed status (conservative)

Migration & Edge Case Analysis

  • Duration-0 + no approval hook = instant ruleset activation: by design, approval hooks are the defense
  • Self-migration fee: foot-gun but not exploitable
  • Zero/extreme values: all well-handled with proper bounds

Cumulative Audit Coverage (Rounds 1-7)

Round Strategy New Findings
1 Deep dive 1 verified
2 Component decomposition 3 verified (#73-#76)
3 Cross-cutting attack chains 1 verified (#77)
4 8 diverse strategies 2 verified (#79, #80)
5 Under-explored repos 2 verified (#84, #85)
6 Deep-dive on 7 subsystems 0 new (all documented)
7 Aggressive exploitation (this round) 0 new (all documented/infeasible)

Status of all findings:

Assessment

Two consecutive rounds (6 and 7) of increasingly aggressive analysis — including concrete Forge exploit tests, independent AI second opinions, and exhaustive line-by-line traces — have returned 0 new actionable findings. The protocol's core defenses (CEI pattern, proportional bonding curve math, bitmap claim tracking, per-terminal balance isolation, fee fail-safes) are sound.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions