A Formal Analysis of Agent Payment Protocols
Organizations: Southern University of Science and Technology · Indian Institute of Technology · City University of Hong Kong
Abstract
Agent payment protocols are emerging as a key transaction layer for autonomous commerce, enabling AI agents to purchase goods and services and execute payments on users' behalf. Unlike conventional payment flows, they distribute user intent, delegated authority, credential use, settlement, and fulfillment across multiple actors and stages, creating security dependencies that no single message or participant can enforce. Yet these guarantees remain largely implicit across evolving specifications, schemas, and reference implementations, with little systematic formal analysis. We formalize four representative agent payment protocols: x402, MPP, ACP, and AP2 in Tamarin. Using a common abstraction of the agent payment lifecycle, we construct source-grounded models that capture each protocol's roles, state, trust assumptions, and lifecycle transitions. Rather than assuming a complete property taxonomy, we use source-backed verification questions and counterexample traces to expose missing bindings, state constraints, and cross-stage correspondences, consolidating them into 18 shared security principles. Across 86 verification cases, our analysis reproduces 46 known or calibration cases and identifies 40 previously undocumented formal-consistency findings. For each retained violation, we isolate the missing protocol relation, construct a minimally strengthened reference model, and reverify the intended property. We further evaluate the new x402 findings across three implementations and validate ten representative findings through implementation PoCs, SDK/schema-level witnesses, and source-aligned executable traces spanning five security principles. Our results show that delegated authorization must remain consistent with its resulting economic and service effects across actors, states, and protocol stages.
Figures & tables
| Domains | Concerns | Principal roles | Lifecycle span | Guiding question |
| Integrity | Binding; semantics; authorization | User, agent, wallet, provider, facilitator, registry | Intent and discovery through authorization, settlement, and result | Do identities, terms, authority, and protocol semantics remain consistent across actors and stages? |
| Payment | Uniqueness; budget; scope | User, wallet, provider, facilitator, ledger | Authorization through verification, metering, settlement, and recovery | Does each authorized payment produce only its intended economic effects and remain within its authorized scope and budget? |
| Service | Selection; delivery; lifecycle | User, agent, registry, provider, facilitator | Discovery through execution, delivery, settlement, and recovery | Does execution preserve the selected service and terms, and remain consistent through delivery, failure, and recovery? |
| Domain | ID | Property family | Canonical relation |
| Integrity | P1 | Complete Terms Binding | All roles that authorize, verify, settle, or deliver agree on the complete payment context. |
| P2 | Authorization Completeness | Every economic effect is covered by prior authorization for recipients, bounds, fees, and delegated authority. | |
| P7 | Subject and Entitlement Consistency | The authenticated subject, payer, authorizer, and service recipient agree or are linked by explicit delegation. | |
| P9 | Canonical Transport Semantics | All accepted encodings and transports resolve to the same payment context at every consuming role. | |
| P12 | Extension, Version, and Scheme Downgrade Safety | Unsupported or ambiguous variants cannot weaken the selected protocol semantics. | |
| P18 | Actor, Endpoint, and Key Authenticity | Accepted actors, endpoints, and keys resolve to the intended trusted bindings rather than attacker controlled substitutes. |
| x402 finding(s) | Coinbase [ 38 ] | Thirdweb [ 34 ] / x402-rs [ 39 ] |
| 01, 03, 05, 14, 25 | Reproduced | Reproduced |
| 09, 12 | Reproduced | Mitigated |
| 08, 19, 24, 28, 29, 30 | Reproduced | N/A |
| Case | Property | Validation level | Validated evidence |
| x402-28 | P9 Canonical Transport | Implementation PoC | A non-canonical MCP challenge reaches automatic payment creation. |
| ACP-18 | Contract / conditional | The OpenAPI contract permits unsigned mutating requests; under a post-TLS trust-boundary failure, no mandatory end-to-end body integrity remains. | |
| x402-01 | P18 Actor Authenticity | Client implementation PoC | Payment terms presented through the transport boundary reach payload creation without an explicit server-provenance check. |
| AP2-17 | SDK witness | A distinct Merchant object is accepted through display-field fallback matching when stable IDs are empty. | |
| AP2-02 | P1 Complete Terms Binding | SDK witness | Closed-mandate verification can omit validation of the final-checkout binding. |
| ACP-15 | Schema / contract | The authentication-result object does not bind the authoritative final checkout context. |
| Finding | Evidence source | Issue summary | Properties | Match strength |
|---|---|---|---|---|
| x402 | ||||
| X402-02 | [ 17 ] , Sec. 4.2; [ 16 ] , implementation audit; M3 | Payment authorization does not bind the requested resource (“pay A, get B”). | P1, P15 | Direct |
| X402-04 | [ 17 ] , Sec. 4.1; [ 16 ] , Attack I-A; [ 35 ] , Free Shopping; SR4 | Verification, settlement, and finality are decoupled, permitting delivery before failed settlement. | P4, P6, P13 | Direct |
| X402-06 | [ 17 ] , Sec. 5.2 | A dynamic request can exceed the remaining payable allowance before failure is detected. | P8, P13 | Direct |
| X402-07 | [ 17 ] , Sec. 5.2 | Concurrent dynamic requests share an unlocked allowance snapshot. | P3, P6, P8 | Direct |
| X402-10 | [ 16 ] , Attack II; M3; repository PRs 2307, 2469 | A payment idempotency identifier is not bound to the request/resource fingerprint. | P1, P3 | Direct |