Skip to content

Security audit: gas-budget waive/cap escalation paths #84

@abhicris

Description

@abhicris

Problem

Once issue #78 (block-builder-level budget enforcement) lands, the gas budget becomes a chain-side invariant. Any waiver path — committee 2-of-N quorum lifting the cap for emergency drain, operator-set overrides, epoch resets — is a potential escalation vector. A buggy waiver flow lets an attacker silently inflate cap or trigger an unintended drain, undoing the protective intent of the budget.

We need an explicit security audit of every code path that can raise, reset, or bypass an agent's gas budget.

Proposed Approach

  1. Enumerate all paths that mutate AgentBudget state:
    • release events that increment *_spent
    • x402_middleware.settle events that increment *_spent
    • waiveEpoch(agentId, newCap) (committee path)
    • resetEpoch() (time-based reset)
    • setCap(agentId, hourly, daily) (initial provisioning)
  2. For each, identify the trust assumption (which key signs, which contract calls, what state transitions are allowed).
  3. Threat model:
    • Malicious committee member tries to silently raise cap during a release window
    • Reentrancy via release -> external call -> waiveEpoch -> release chain
    • Replay of an old waiver signature against a new epoch
    • Time-based reset triggered ahead of schedule via chain re-org
  4. Doc: docs/security/gas-budget-threat-model.md covers all enumerated paths + the mitigation per path.
  5. Third-party review on the waiver flow specifically (target: existing Switchboard auditor, or one of the Lux ecosystem auditors).

Acceptance Criteria

  • Threat model doc published
  • Reentrancy guard verified on all waiver-relevant entry points
  • Replay protection: waiver signatures bound to (agentId, epoch, nonce) tuple
  • Third-party audit signed off on the waiver flow before mainnet
  • No silent-escalation path identified in the published model

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions