T09 · Insecure Skill Coding Practices
- Location
scripts/vote-and-post.mjs:68- Finding
Unrestricted x402 Payment Authorization
- Content
View full analysis
Vulnerability Details
File Location:
scripts/vote-and-post.mjs, lines 68-81
Vulnerability Type: Missing network, asset, recipient, and amount restrictions
Risk Level: HighVulnerable Code
js async function fetchWithX402(url, opts = {}) { const { wrapFetchWithPaymentFromConfig } = await import("@x402/fetch"); const { ExactEvmScheme } = await import("@x402/evm"); const account = getAccount(); const payFetch = wrapFetchWithPaymentFromConfig(fetch, { schemes: [ { network: "eip155:*", client: new ExactEvmScheme(account), }, ], }); return payFetch(url, opts); }Technical Analysis
The x402 client authorizes payment handling for every EVM network matching
eip155:*. The application does not independently validate or restrict:- The chain to Base mainnet (
eip155:8453) - The payment asset to the expected USDC contract
- The payment recipient to the documented revenue wallet
- The maximum payment amount
- The expected price for each operation
Consequently, security-sensitive payment terms are delegated to the remote x402 response and the payment libraries. This does not enforce the narrower behavior documented in
SKILL.md, which states that voting costs $0.01 USDC, minting costs $1.00 USDC, and transactions occur on Base.Attack Path
- A user invokes the vote or mint command with a funded EVM wallet.
- The configured API endpoint is compromised, malicious, or incorrectly configured.
- The endpoint returns x402 payment requirements containing an unexpected network, asset, recipient, or excessive payment amount.
- The generic
eip155:*payment client processes the payment challenge. - No application-level policy rejects payment terms that differ from the documented transaction.
Impact Assessment
An attacker controlling the payment endpoint may be able to cause the wallet to authorize transactio ...[truncated 354 chars]
- The chain to Base mainnet (
- Remediation
View remediation
Remediation Suggestions
- Replace the wildcard network with an exact Base mainnet restriction:
eip155:8453. - Validate the x402 payment requirements before signing or submitting any transaction.
- Hard-code or securely configure an allowlist containing:
- The expected chain ID
- The official USDC asset contract
- The authorized payment recipient
- The permitted payment scheme
- Apply separate maximum payment limits for each operation:
- Vote: no more than the documented $0.01 USDC
- Mint: no more than the documented $1.00 USDC
- Reject payment requirements containing additional transfers, unknown contracts, or unexpected calldata.
- Require explicit user confirmation whenever payment terms differ from the locally defined policy.
- Log validated payment details without exposing the private key or other sensitive wallet material.
- Replace the wildcard network with an exact Base mainnet restriction:
