x402 Security Audit

Flat-fee security audits for x402 integrations, gateway routes, and the contracts behind them. From $3k.

x402 lets agents pay per API call in stablecoins. The protocol just stabilized at v2 under the Linux Foundation, and the network already settles tens of millions of dollars. The flip side is that every new x402 service inherits the security surface of HTTP, on-chain settlement, agent identity, and signed-payment verification all at once. A single missing nonce check, a poorly handled facilitator response, or a mis-configured CAIP-2 network is the kind of bug that drains a wallet in production.

We audit x402 integrations with three tools we own. The HSS security lab models twelve attack archetypes against working exploits and patches. Our Solidity sniffer scans contracts against those archetypes plus the Slither rule set, mapping every finding to a remediation walkthrough. And we run a multi-tenant x402 gateway in production that has handled real money on XRPL Mainnet, so we know which classes of bug actually happen and which are theoretical.

Three Tiers

Pick the Depth You Need

Each tier is flat-fee with a written delivery date. No hourly creep. No surprise invoices.

Tier 1

Quick Scan

$3k
3 to 5 days · flat fee
  • hss-sniffer scan of your Solidity surface
  • Manual review of x402 challenge and verify flow
  • One-page findings memo with severity and fix pointers
  • 30-minute walkthrough call
  • Best for: pre-mainnet validation, due diligence
Book a Quick Scan
Tier 3

Hardened

$12k
2 to 3 weeks · flat fee
  • Everything in Full Audit
  • Remediation pairing with your engineering team
  • Echidna property-based fuzzing on critical paths
  • Re-audit after fixes until findings clear
  • Public attestation badge for your service
  • Best for: high-TVL protocols, agency-facing services
Book Hardened Engagement
Scope

What an x402 Audit Actually Covers

Six areas mapped against the x402 v2 spec, our 12-archetype security lab, and what we have learned running BitBooth in production.

Challenge and verify flow

402 challenge construction, accepts array correctness, payment-header schema validation, expiry handling, replay protection via nonce store and idempotency keys.

On-chain settlement verification

Per-chain adapter correctness for Base, XRPL, Solana, Stellar. Confirmation depth, payTo validation, amount-base-unit handling, network mismatch detection, CAIP-2 parsing.

Smart contract surface

Reentrancy, access control, signature replay, oracle manipulation, share-inflation, delegatecall storage collision, unchecked external call, and the rest of the 12 archetypes from our security lab.

Wallet and key management

Agent wallet provisioning, hot wallet exposure, KMS or Secrets Manager handling, multi-sig requirements for high-value routes, key rotation runbook.

Tenant isolation and abuse

Per-tenant rate limiting, fraud event tracking, route-level configuration injection, multi-tenant data leakage, billing edge cases.

Operational resilience

Webhook delivery DLQ, RPC failover, facilitator availability, observability gaps, incident response readiness, rollback paths.

Tooling

The Stack Behind the Audit

Every tool we use is open source or our own. Public, auditable, no black boxes.

HSS Security Lab 12 archetypes, working exploits and patches
HSS Sniffer Solidity static analysis CLI
Slither With HSS rule overlays
Foundry Test harnesses and fuzz campaigns
Echidna Property-based fuzzing (Hardened tier)
HSS x402-core Reference implementation, 117 tests, 99.78% coverage
Deliverable Sample

What a Finding Looks Like

A sanitized example pulled from our security lab fixtures.

High

Missing nonce-replay guard on x402 verify path

The enforceX402 handler validates the payment-header schema and the on-chain transaction reference, but does not check the nonce against a seen-nonces store before accepting it. An attacker can replay a previously confirmed payment to repeatedly access the same paid resource without sending new on-chain payments.

// Before
const verify = await adapter.verifyPayment({ txHash, expectedTo, ... })
if (verify.ok) return resource

// After
const seen = await nonceStore.has(payment.nonce)
if (seen) throw new ReplayError("nonce already used")
const verify = await adapter.verifyPayment(...)
if (verify.ok) {
  await nonceStore.put(payment.nonce, ttl)
  return resource
}

Recommended fix: Wire a TTL-bounded nonce store (DDB / Redis / Postgres) into the verify path. Reject any payment whose nonce has been seen within the payment-window seconds. Reference: hss-x402-core / src / middleware / withIdempotency.ts.

Archetype: 03-signature-replay Effort: 2 hours Severity: High
Why HSS

Why We Are Qualified

  • Production x402 gateway operator. We run BitBooth, a multi-tenant x402 gateway live with real money on XRPL Mainnet. We know which bugs actually happen because we operate the surface.
  • 14 published open source libraries at github.com/heinrichs-software, every module 100% test coverage and zero Slither findings. The bar we hold ourselves to.
  • 12-archetype security lab with working exploits and patches covering The DAO, Parity, bZx, Harvest, Cream, LI.FI, Nomad, KelpDAO, and Euler-class bugs. Public, reproducible, peer-reviewable.
  • SDVOSB veteran-owned. Service-Disabled Veteran-Owned Small Business, SAM.gov registered, qualified for federal set-aside contracts and CMMC Level 2 readiness work.
  • Multi-chain coverage. XRPL classic, XRPL EVM sidechain, EVM (Ethereum, Base), Solana, Stellar. Most audit shops are single-chain.

Free 25-Point x402 Security Checklist

Self-review your x402 integration before you book an audit. Covers nonce replay, settlement verification, wallet exposure, tenant isolation, and 21 more checks. Free, email-gated, no obligation.

Get the Checklist Book an Audit Call