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
- Give each agent only the tools and folders it needs for the task at hand.
- Require manual approval before it runs shell commands, sends network requests, deletes files or spends money.
- Do not open untrusted repositories or MCP configs with auto-run turned on.
- Keep API keys and production credentials out of any environment an agent can read.
More on this: every trusting agents & ai input story and our related guide.
Tools involved
x402 stories, AI agents stories, Coinbase stories
Related stories
- Require approval before your agent runs shell or code tools
LangAlpha agent could be hijacked by web pages to run shell commands - If you run Hermes Agent with Bot Desktop inside a docker or ssh terminal backend, upgrade to 0.23.2 or later
Hermes Agent: code inside its Docker or SSH backend could set env vars on the agent's own machine, fixed in 0.23.2 - If you give an AI agent mcp-server-git, upgrade it to 2026.11.18 or later today, and don't point it at repos you haven't checked
mcp-server-git: six more ways a repo's own Git config could run commands, fixed in 2026.11.18
Source: original post on News ↗. Summarised in our own words; numbers are as stated by the source. Browse all stories.