Cap what your AI agent can pay per request

x402 SDK flaw could let a malicious API drain an AI agent's token balance · Security incident · News · thehackernews · Oct 22, 2026

What happened

Security firm V12 said on 22 Oct that the default x402 client, used by AI agents to pay for API calls inside the web request, set no spending limit until releases on 18 Aug, so a hostile API could ask an automatic signer for its full balance of a supported token. V12 found 25 flaws and rated three critical, including a TypeScript Solana facilitator accepting a token approval as a payment and a login message signed for the wrong website. The x402 Foundation had fixed all three on 18 Aug without a security advisory, and no attacks have been reported.

How to prevent it

Never let an agent sign payments without a per-payment limit and a total budget, and keep only a small balance in the wallet it uses. Update payment SDKs even when the release notes do not mention security.

Fix prompt for your own AI tool

Copy this into your own AI tool (Cursor, Lovable, Claude Code, Bolt…). It's general guidance written by us. Review what the AI suggests before applying it.

I'm building or using an AI agent that can pay for API calls automatically, possibly with the x402 SDKs (@x402/fetch, @x402/axios, @x402/core, @x402/svm, @x402/extensions, or the Python and Go packages). Help me make it safe. 1) Find out whether my project uses x402 and which version, and tell me whether it is older than 2.23.0 for the TypeScript packages. 2) Show me how to upgrade to a current release and what changes after the upgrade (payments are now capped at $1 and limited to recognised stablecoins by default). 3) Help me set my own limits: a maximum per payment, a total budget, and an allow-list of tokens, networks and recipients. 4) Check that the agent only holds a small balance in the wallet it uses to pay. 5) Check that I don't turn the spend controls off with spendControls: false. Don't change anything until I've approved your plan. Never ask me to paste API keys, passwords or .env contents; tell me where to check them myself.

Why this keeps happening: trusting agents & ai input

An AI agent treats everything it reads as possible instructions: a web page, a README, an email, a code comment or the output of another tool. If that content was written by an attacker, the agent can be steered into running commands, reading files or sending data somewhere it should not.

A quick checklist before you ship

More on this: every trusting agents & ai input story and our related guide.

Tools involved

x402 stories, AI agents stories, Coinbase stories

Related stories

Source: original post on News ↗. Summarised in our own words; numbers are as stated by the source. Browse all stories.

The Honest Build. Real stories, not hype.

Every week: real stories of what building with AI actually took, the one lesson worth keeping, and the security slip-ups to avoid. Free, unsubscribe anytime. Weekly, every Friday.