The quote was the attack
An x402 payment can match its quote exactly and still empty the agent's wallet.

A payment can match its quote exactly and still empty the wallet. That's the line I keep coming back to from last week's x402 security news, and I think every team building agent payments on Stellar should take it seriously.
We spend a lot of time asking whether agents can pay. The rails mostly work now. The harder question is whether an agent should pay this amount, to this seller, for this job, and who decides. Last week showed what happens when nobody does.
What happened
Security firm V12 reviewed the official x402 SDKs, the libraries agents use to pay for API calls. They found 25 flaws, three of them critical. All three were fixed in August, and no exploit has been reported. The three critical ones, in plain terms:
- The default client had no spending limit. It paid the first option the server listed. The server chose the amount, the token, the recipient and the network. A hostile API could ask for the whole wallet balance and get it.
- A Solana approval passed as a payment. The facilitator decoded an
ApproveCheckedinstruction as if it were aTransferChecked, because the two look almost identical. The merchant delivered and got nothing. - Logins signed for other sites. The sign-in wrapper copied the domain from the server's 402 response and signed it without checking it matched the site the agent had called. A server could relay another site's login and take over that session.
The fix now turns on a cap by default: $1 per payment, recognised stablecoins only. The disclosure was weaker. There was no CVE or advisory, and npm audit stayed silent for the affected versions. A team that relied on its tooling to tell it when to upgrade was never told.
The real lesson: the bill is a claim, not a fact
Flaws two and three are parsing mistakes. They're bad, but they're the kind of bug every protocol ships and patches. Flaw one is different. Nothing broke. The client did exactly what it was built to do: read the 402, take the first option, sign.
The problem is who wrote the 402. It came from the party being paid. In x402, the seller sends the bill and the buyer's agent settles it. If the only check is "does the payment match the quote?", then a malicious quote passes every time. Conformance has no opinion on whether a price is reasonable.
V12 put it in one sentence worth pinning to every agent-payments team's wall: "Optional policies only protect applications that actually enable them." A budget is something only the payer can set, and it has to live somewhere neither the model nor the seller can touch. The same week, a Cornell Tech/Yale study reportedly found 9 of 10 models raised their own spending cap by reading an emailed one-time code. So "the agent will be sensible" isn't a control either.
Three principles fall out of this:
- The payer sets the budget. Never the merchant's 402, never the model.
- Verify the action, not just the shape. A transaction that looks like a payment has to be a payment.
- Bind every signature to its context. Who asked, for which site, for which job.
Where Stellar starts ahead
Stellar didn't dodge this by luck. A few design choices already line up with those three principles. Here's how each critical flaw maps onto Stellar today.

The Solana bug happened because the facilitator inferred intent from bytes that looked alike. On Stellar the signed authorization entry states the function being authorised. An approve and a transfer are different calls in the signed payload, not one byte apart in a decoded instruction. That doesn't make Stellar immune, since SEP-41 tokens do have approve. But the check is explicit and cheap, and the official facilitator already does it.
The big one is the first row. Stellar's x402 flow is just as exposed to a hostile quote as Base or Solana were. The difference is that Stellar has a strong native place to put the fix.
How to fix it on Stellar
1. Put the budget in the account, not the app. OpenZeppelin's Stellar smart accounts support policies that run inside the account's own authorization check. The built-in spending_limit policy caps total transfer spending over a rolling window of ledgers. The Agent Wallet walkthrough shows the shape I'd want for every agent:
- An owner rule with full control and recovery.
- An agent rule that can only call one token contract, only until a set expiry ledger, and only up to a cap per period.
In their demo, a payment over the cap is rejected on-chain with SpendingLimitExceeded. That's the point: the limit isn't in the SDK, the prompt or the merchant's 402. It's in the account. A hostile quote, a jailbroken model and a buggy client all hit the same wall.
2. Make capped the default, not an option. V12's line applies to us too. If agent wallets on Stellar ship uncapped and let developers opt in, most won't. Wallet kits, x402 client SDKs and agent frameworks on Stellar should create an agent rule with a small cap and expiry by default, and make removing it an explicit, noisy choice.
3. Check the quote before signing, too. On-chain policy is the last line. The client should still refuse quotes over a per-request ceiling, for unknown assets, or to payees it hasn't seen, before it asks the wallet anything.
4. Facilitators verify the action, every time. Confirm the function is transfer on the expected token, the amount and payee match, the authorization hasn't expired, and the simulation succeeds. The public facilitator does this. Anyone self-hosting the OpenZeppelin Relayer plugin, or writing their own, should treat those checks as non-negotiable.
5. Never sign a login built from a 402. If an x402 service needs identity, use SEP-10/SEP-45, where the challenge is tied to a domain and a published signing key. Agents should check that domain against the host they actually called.
6. Disclose like it matters. The x402 fixes shipped without a CVE or advisory. Stellar's ecosystem is small enough to set a better norm: security fixes in agent-payment SDKs get labelled, get an advisory, and show up in audit tools.
Honest caveats
- The OpenZeppelin Agent Wallet is a testnet demo, not a reviewed wallet. Client support for the v0.8.0 signing digest is still in progress.
- Smart-account payers need much higher resource fees than classic accounts, so facilitators' fee caps have to allow for that.
- The
spending_limitpolicy only coverstransfer, and keeps at most 815 entries of history in its window. - One public facilitator handles a lot of the traffic. That's convenient, and it's also concentration risk.
The layer limits can't cover
Spending limits stop an agent from paying too much. They don't stop it from paying the wrong seller.
The same week, nohumans.directory published an audit of 6,478 x402 endpoints it had paid with real USDC. Roughly 6 in 10 delivered. 464 asked to be paid a second time, and 146 took the payment and then threw a server error. Every one of those payments could sit comfortably under a $1 cap and still be money for nothing.
So the full answer has two halves. Budgets live in the account, so a bad quote can't drain it. Track records live on-chain, so an agent can check a seller's history before it pays.
That second half is what I'm building with AgentKred. It's an on-chain work-reputation registry for agents on Stellar, where escrow outcomes become reputation records. A job that was delivered and released, or disputed and refunded, becomes a record any marketplace or facilitator can read. It's infrastructure, not a marketplace. Picture a smart account with a spending policy that asks one more question before it signs: has this payee actually delivered before?
A checklist for Stellar agent-payment builders
- Agents pay from a smart account with a
spending_limitpolicy, an expiry and an owner recovery rule. - The client SDK has a per-request ceiling and an asset/payee allowlist, on by default.
- The facilitator checks function, token, amount, payee and expiry, and simulates before settling.
- Identity uses SEP-10/SEP-45, checked against the host the agent actually called. Never a login copied from a 402.
- Security fixes ship with an advisory, not a quiet changelog line.
- Before paying a new seller, the agent checks its delivery record.
The x402 bugs got fixed without anyone losing money, as far as we know. We got a free lesson. Stellar has the account model to make capped, scoped, expiring agent wallets the default rather than a feature. Let's actually ship them that way, before the lesson stops being free.
Sources
- Agent Wormhole: x402's SDKs, when the quote is the attack, summarising V12's report
- Built on Stellar x402 Facilitator, Stellar Docs
- OpenZeppelin Stellar Contracts: Agent Wallet
- OpenZeppelin Stellar Contracts: Policies
- SEP-45 guide, Stellar Docs
- nohumans.directory audit, via @RoundtableSpace
- Cornell Tech/Yale finding, via @btc___no1