T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:201
- Finding
- Remote Payment Parameters Are Signed Without a Mandatory Local Spending Policy<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 201–215 **Vulnerability Type**: Insufficient validation of wallet payment authorization parameters **Risk Level**: High ### Vulnerable Code Snippet ```text ### Constructing the Payment Header For EVM networks (Base), the payment uses EIP-3009 (transferWithAuthorization on the USDC contract): 1. Parse the `PAYMENT-REQUIRED` header and select a payment option from `accepts` 2. Build an EIP-712 typed data structure with `from`, `to`, `value`, `validAfter`, `validBefore`, and `nonce` 3. Sign it with the client wallet's private key 4. Base64-encode the signed payload 5. Include it as `X-PAYMENT: <base64-payload>` The client does NOT submit a blockchain transaction. The authorization is gasless. The x402 facilitator submits the signed transfer on-chain on behalf of the client. ``` ### Technical Analysis The documented procedure instructs clients to parse payment parameters supplied by the remote endpoint and sign an EIP-3009 transfer authorization. It does not require the client to independently validate the requested network, token contract, recipient, transfer amount, authorization lifetime, or facilitator against a trusted local policy. The Skill states that a request costs $0.25 USDC, but the signing flow does not mandate an enforcement check that rejects any authorization exceeding that amount. It also does not require explicit user approval after displaying the final typed-data fields. An EIP-3009 authorization is not merely an authentication signature. It can authorize an on-chain token transfer when submitted by a facilitator. Consequently, blindly signing server-provided parameters exceeds the minimum privilege needed to pay the advertised fixed request price. ### Attack Path 1. The user or agent contacts the documented endpoint and receives an HTTP 402 response. 2. The endpoint, an intermediary, or compromised service supplies manipulated `PAYMENT-REQUIRED` parameters. 3. Th ...[truncated 1041 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Enforce a trusted local payment policy before signing: - Require network `eip155:8453`. - Require the expected Base USDC contract address. - Require an independently verified recipient address. - Reject any amount above exactly $0.25 USDC per request. - Reject unsupported schemes and facilitators. 2. Compare all server-provided payment fields against the agent card and a separately configured local allowlist. 3. Display the network, token, recipient, amount, and expiration to the user and require explicit confirmation before each signature. 4. Use short authorization validity periods and cryptographically random, single-use nonces. 5. Reject malformed, ambiguous, duplicated, or unexpectedly encoded payment requirements. 6. Use a dedicated low-balance wallet rather than a primary treasury or personal wallet. 7. Log payment decisions and settlement references without logging private keys or reusable authorization data. 8. Ensure redirects cannot silently change the payment recipient or destination origin. ]]>
