true402
guide · x402 security

Where x402
goes wrong.

An x402 payment is a signature for an exact amount to a named address. That part is sound. What 2026's research found broken was everything around it: when access is granted, who settles, what a cache keeps, which server an agent trusts. Here is each published finding, and what we do about it.

§01 · five attacks

The paper everyone cites.

"Five Attacks on x402" (Li, Wang and Wang, May 2026) audited Coinbase's TypeScript stack and two third-party SDKs. The attacks, the fix the authors propose, and what true402 does:

AttackWhat happensProposed fixWhat true402 does
Revert-grantAccess is granted before the payment is final; it later disappears.Reserve, then grant after settlement.The answer is released only after settlement succeeds; a settlement that reverts on-chain withholds it.
Settlement preemptionSomeone who sees the payment header submits it first, so the seller's own settlement fails.Bind settlement to the facilitator.After a refused settlement we look for the matching on-chain transfer to us, for exactly the price. Only that proves payment; the "authorization used" event alone does not.
ReplayOne payment header buys many answers.An atomic single-use claim.Each authorization is claimed once, keyed by network, payer and nonce; a repeat gets 402.
Cache / proxy confusionA CDN or proxy stores a paid response and serves it to others.no-store, private.Everything a payment gate answers carries Cache-Control: no-store, private.
Server-selection manipulationFake or crafted listings steer an agent's choice of seller.Validate metadata, resist Sybils.Our registry ranks by settlement history, requires proof of the listing's origin for any change, and never evicts a listing to make room.
§02 · facilitators

15 facilitators, none perfect.

A second paper, arXiv 2607.19545 (USENIX Security 2026), wrote down 8 rules a facilitator should follow and tested 15 major ones: every one broke at least one rule, enabling attacks the authors call free shopping, asset theft, service denial and gas abuse. Fixes were adopted, including by Coinbase.

The lesson for a seller: a facilitator saying isValid: true is not proof of payment. true402 checks every payment itself — the signature, the payer's balance, an unused nonce, the exact amount, our address — before serving, whatever the facilitator says.

§03 · SDK bugs

25 findings in the SDKs.

On 22 October 2026 V12 published 25 findings it had reported in August: 3 critical, 13 high, 9 medium or low. The critical three, fixed by 20 August per V12:

  • Solana facilitator: it did not check the instruction type, so an Approve with the same layout passed as a payment.
  • Sign-in client: it signed login messages for a domain other than the one it was talking to, enabling a cross-site relay.
  • Default client: no spending limit — it paid the first option offered, whatever the price.

V12 did not publish the fix status of the other 22. The x402 repository lists two published advisories, both for Solana and resource-server SDK versions now patched (advisories). If you run an x402 SDK, stay on current releases.

§04 · checklist

If you sell over x402.

  • Verify the payment yourself; never serve on the facilitator's word alone.
  • Require the exact quoted amount. Refuse overpayment rather than keep it: settlement takes the signed value and there is no refund path.
  • Claim each authorization once, atomically.
  • Release the answer only after settlement; withhold it if settlement reverts.
  • Send Cache-Control: no-store, private on everything a paid route answers.
  • Bound failed attempts per wallet and per address, so one authorization cannot be retried forever.
§05 · checklist

If you buy over x402.

  • Use a dedicated, low-balance wallet: its balance is the most an agent can lose.
  • Set a per-call ceiling in the client and refuse any 402 above it.
  • Never follow a redirect with a payment attached.
  • Keep authorizations short-lived; a far-future expiry is a standing cheque.

true402's published clients do all four. How to set up the wallet: fund a wallet.

§06 · questions

Answered for machines.

Is x402 secure?

The protocol itself holds up: a payment is a signed authorization for an exact amount to a named address, verified before anything is served. The real-world problems found in 2026 were in implementations — servers that granted access too early or twice, facilitators that skipped checks, SDK bugs — and the published ones were fixed. Whether a given service is safe depends on how it implements x402.

What attacks on x402 are known?

A May 2026 paper (arXiv 2605.11781) describes five: granting access before the payment is final, an observer submitting the payment first (settlement preemption), replaying one payment for many answers, caches or proxies serving paid responses, and manipulating which server an agent picks. A July 2026 paper (arXiv 2607.19545) tested 15 facilitators against 8 rules and found every one broke at least one.

What were the 25 x402 SDK vulnerabilities?

Security firm V12 reported 25 findings in the x402 SDKs in August 2026 and published them on 22 October 2026: 3 critical, 13 high, 9 medium or low. The three critical ones — a Solana facilitator that accepted an Approve as a payment, a sign-in client that signed for the wrong domain, and a client with no spending limit — were fixed by 20 August 2026, per V12.

Can an x402 server take more money than the price?

Not if the client checks: the buyer signs the amount itself, so a client should refuse any 402 above its own ceiling. The default client had no such ceiling until August 2026. true402's published clients cap every payment, and true402's server refuses an authorization for more than the quote instead of keeping the difference.

How do I keep an AI agent's x402 wallet safe?

Use a dedicated wallet with a small balance — it is the hard ceiling on what the agent can lose — and a client with a per-call cap. Keep the key out of shared configs and logs. A key that leaks can sign payments to anyone, so fund it like a prepaid card, not a savings account.