Flaws in x402 AI agent payment code could let rogue APIs drain an agent's full token balance
V12, a security firm, reported 25 vulnerabilities in the x402 payment protocol code in a post dated 22 October 2026 and described three critical ones. One was a default client setup with no spending limit, so a hostile server could ask an automatic signer to authorise the wallet's full balance of a compatible token. The x402 releases of 18 August 2026 add spend controls. This site found no security advisory for the fixes.
By Parminder Kumar Sharma · LinkedIn · · 9 min read
Correction, 26 October 2026: the code block, the fix and the Solana flaw were corrected
An audit on 26 October checked this briefing against V12's post and the x402 releases. What changed: the client configuration code block, with maxSpendPerRequest, dailySpendLimit and allowedRecipients, was invented and was removed; the real fix is the spendControls option, with a default cap of one US dollar, in the x402 core package 2.23.0 and the Python package 2.20.0, both released on 18 August; the Solana flaw is an ApproveChecked instruction accepted as payment, not zero token transfers; and the NCSC principles, the testnet proof of concepts, the 0.005 dollar price and the two million fold multiple were removed. The dead links were replaced and the hero figure was replaced.
Unbounded auto-signing exposes autonomous agent treasuries to total balance extraction
V12, a security firm, reported 25 vulnerabilities in the x402 protocol code in a post dated 22 October 2026. The post describes three critical findings: a Solana payment verifier in the TypeScript facilitators that accepted an approval instruction as a payment, a Sign-In-With-X helper that signed a login message naming another website, and a default client setup with no spending limit. Designed to facilitate machine-to-machine micropayments by revitalising the long-dormant RFC 9110 status code HTTP 402 Payment Required, the protocol enables artificial intelligence agents to purchase API compute, proprietary data feeds, and execution tooling using on-chain stablecoins such as USD Coin (USDC). On the spending limit, V12 says the documented default client setup enforced no per-payment limit and no total budget, so a hostile server could request the wallet's full balance of a compatible token, and an automatic signer with no application policy could sign it.
V12 does not give a typical payment size, so this site has removed the per-query figure and the overcharge multiple that an earlier version built on it. V12 does say that a hostile API could turn a routine data request into a request for the wallet's full balance of a compatible token, and that if needed an earlier small payment could reveal the wallet address so the server could look up the balance first. V12 puts the practical limits at the wallet's balance and any external signer restrictions, and says the attack needs a token that supports the signed transfer mechanism.
What the audit establishes and what the vulnerability record leaves unstated
To evaluate the real operational threat to enterprise artificial intelligence deployments, developers and treasury managers must distinguish verified protocol defects from theoretical attack vectors.
Audit of verified technical disclosures in the V12 audit versus unstated deployment assumptions
| Technical Dimension | Explicitly Established by V12 Audit | Not Stated or Dependent on Environment |
|---|---|---|
| Vulnerable Code | V12 says the documented default client setup applied no per-payment limit or total budget. Its code excerpts are TypeScript. The x402 changelogs show a client spend controls option added in the TypeScript 2.23.0 and Python 2.20.0 releases of 18 August 2026, with a default cap of 1 USD per payment. | The proportion of third-party community SDKs or custom agent frameworks that independently implemented wallet caps. |
| Facilitator Verification | V12 says the TypeScript Solana facilitators for the v1 and v2 exact schemes parsed the third instruction as a transfer without checking its type, so an ApproveChecked instruction, which moves no tokens, passed verification. | Whether any merchant was actually served without payment through this path. V12 says its local test did not submit a live transaction. |
| Signature Safety | V12 says the Sign-In-With-X wrapper signed a login message taken from the 402 response without checking that its domain and uri matched the site the client had contacted, which could allow session takeover on a target site that accepted the relayed challenge. | Whether any production agent private keys were directly extracted from memory or persistent storage. |
| Remediation Timing | The npm registry shows @x402/core 2.23.0 published on 18 August 2026, and PyPI shows x402 2.20.0 the same day. Their changelogs add client spend controls and, in the TypeScript packages, origin binding for Sign-In-With-X signing. V12 says the three critical findings were fixed by 20 August 2026. | Why no GitHub Security Advisory was published for these fixes, and whether a CVE identifier was requested. This site found no CVE for the three critical findings in an NVD keyword search on 26 October 2026. |
| Exploitation State | V12 says its tests ran locally with the real token encoders, parser and SIWE library, and that the Solana test did not submit a live transaction. | Evidence of active, coordinated in-the-wild balance draining targeting autonomous agents prior to patch release. |
The friendly-name fallacy: why automated micropayments enabled macro-theft
The systemic failure in early x402 implementations exposes a dangerous friendly-name fallacy in agentic finance. The x402 Foundation describes the standard as one for internet-native payments, and V12 describes the use case as automated clients and AI agents buying data or services without a person approving every request. This site's inference is that a reader can take small per-request payments to mean the protocol limits the amount. V12 shows that the default client had no such limit.
In V12's description, the server supplies the payment details, including the amount, token, network and recipient, the client signs a payment payload, and the request is retried with the payload attached. This site's inference is that settlement on the chain cannot tell a routine API call from a deliberate transfer, so the limit has to sit in the client. V12 says the documented default client selected the first supported payment option and applied no spending policy, so the server-supplied amount reached the signing code.
The V12 post describes two further critical findings. In the TypeScript Solana facilitators, the verifier checked that a transaction called an allowed token program, then parsed its third instruction as TransferChecked without checking the instruction type. ApproveChecked has the same data layout and differs only in its first byte, and it grants spending permission without moving tokens. V12 says its local test returned isValid true for such an approval, and that a merchant relying on the affected facilitator could deliver a paid resource while receiving no tokens. In the Sign-In-With-X extension, the automatic wrapper signed a login message supplied in the 402 response without checking that its domain and uri matched the website contacted, so an attacker controlling one server could relay a login challenge from another site and, where that site accepted it, take over the session.
Code level guardrails in the fixed releases
The x402 changelogs show the fix. The @x402/core 2.23.0 entry, released on 18 August 2026, adds client spend controls: by default only recognised pegged assets are allowed, with a cap of 1 USD per payment, other tokens are opt-in through an allowed assets list with an optional per-payment maximum, and setting spend controls to false disables them. The Python package x402 2.20.0 of the same day adds an equivalent spend controls option. The 2.23.0 entry also requires the response URL when creating a Sign-In-With-X payload and refuses to sign when the challenge origin does not match it, and the @x402/svm 2.23.0 changelog lists a validation guard for TransferChecked. V12 says the three critical findings were fixed by 20 August 2026.
V12 says it reported the critical findings to the x402 team on 12 August 2026. The fixes shipped in the 18 August releases. The repository's GitHub advisory list shows no advisory for them, the changelog entries do not label them as security fixes, and this site's npm advisory query for @x402/core and @x402/fetch 2.22.0 returned no advisories on 26 October 2026, so npm audit would not have flagged those releases. This site could not establish whether a CVE identifier was requested or why no advisory was published. V12 published its post on 22 October 2026, 65 days after the fixed releases (derived). An agent running a release older than 2.23.0 stayed exposed until its operator upgraded.
Defender checklist: hardening autonomous agent financial controls
Take this with you
Ordered engineering priorities for securing agentic micropayment pipelines
- Upgrade the x402 TypeScript packages to 2.23.0 or later and the Python package x402 to 2.20.0 or later, both released on 18 August 2026, and check every agent deployment, because the fixes shipped without a security advisory.
- Set an explicit per-payment limit and a total budget in client code, as V12 advises, instead of relying on the 1 USD default cap added in the August releases.
- Implement daily and hourly treasury velocity limits to prevent high-frequency automated depletion across multiple small requests.
- Segregate operational agent wallets: never connect autonomous signing keys to high-balance primary corporate treasuries.
- Enforce destination allowlists: restrict agent payment authorisations exclusively to pre-verified vendor contract addresses.
- Deploy external policy middleware (such as an agentic firewall or transaction proxy) that evaluates payments independently of the LLM core.
- If you run a TypeScript Solana facilitator, upgrade @x402/svm to 2.23.0 or later and confirm that verification checks the instruction type, so that an ApproveChecked instruction is not accepted as a transfer.
The exposing question
When your autonomous artificial intelligence agents are granted cryptographic signing keys to purchase compute and data, does your architecture enforce hard financial stop-losses outside the agent's software execution path?
Key facts
Sources
- Primary25 Vulnerabilities in the x402 Protocol: Inside Three Critical FindingsV12accessed 2026-10-26
- Primary@x402/core Changelogx402 Foundation (GitHub)accessed 2026-10-26
- PrimarySecurity Advisories, x402-foundation/x402x402 Foundation (GitHub)accessed 2026-10-26
- PrimaryLinux Foundation is Launching the x402 Foundation and Welcoming the Contribution of the x402 ProtocolLinux Foundationaccessed 2026-10-26
- Reported byCritical x402 SDK Flaw Could Let Malicious APIs Drain AI Agents' Token BalancesThe Hacker Newsaccessed 2026-10-26


