Back to skill

Security audit

x402-endpoint-guide

Security checks for vulnerabilities and agentic risk

Overview

The skill is a focused x402 paid API guide, but its sample payment gate could let a caller reuse one valid payment authorization without enforcing a fresh settled payment per call.

Use this as a conceptual guide, not production-ready payment code. Before deploying, require successful settlement before doing paid work, store and atomically reject reused payment identifiers or nonces, validate facilitator responses and expected recipient/network/asset/amount, make the facilitator configurable or reviewed, and document what payment data leaves your system.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:39
Finding

Payment Verification Without Settlement Allows Replayed Paid Access

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 39–50
Vulnerability Type: Payment authorization replay / incomplete payment enforcement
Risk Level: High

Vulnerable Code

python
payload = json.loads(base64.b64decode(x_payment).decode())
r = httpx.post("https://x402.org/facilitator/verify", json={
    "x402Version": 1,
    "paymentPayload": payload,
    "paymentRequirements": REQUIREMENTS,
}, timeout=15)
if not r.json().get("isValid"):
    return JSONResponse(status_code=402, content={"error": "payment invalid"})
return JSONResponse(content=do_the_work(await request.json()))

Technical Analysis

The documented endpoint treats a successful response from the facilitator's verification operation as sufficient authorization to execute the paid service. It does not settle the payment, record a consumed authorization identifier or nonce, or otherwise enforce one-time use before calling do_the_work.

The remote caller controls the base64-encoded payment payload supplied through the X-PAYMENT HTTP header. Once the caller obtains a valid signed payment authorization, the same payload can be submitted repeatedly while it remains valid. Because the implementation only verifies the authorization and has no local replay protection, repeated requests can pass the paid-access check without evidence that a distinct payment was settled for each invocation.

This crosses the endpoint's payment authorization boundary: an unauthenticated remote client receives per-call functionality based on a reusable authorization rather than a uniquely settled payment.

Attack Path

  1. A remote client requests the paid endpoint and receives the HTTP 402 payment requirements.
  2. The client creates one valid signed payment authorization satisfying those requirements.
  3. The client submits that authorization in the X-PAYMENT header.
  4. The facilitator reports the payload as valid, and the endpoint executes ...[truncated 864 chars]
Remediation
View remediation

Remediation Suggestions

  • Settle every verified payment through the facilitator before invoking do_the_work, and grant access only after receiving an authenticated successful settlement response.
  • Enforce one-time use by recording a unique authorization identifier or nonce in durable storage and atomically rejecting duplicates.
  • Validate the settled payment against the exact expected recipient, network, asset, amount, scheme, and validity window rather than relying only on a generic validity flag.
  • Bind each accepted payment to the relevant request or operation where the protocol supports such binding.
  • Make settlement and replay-state updates atomic so concurrent submissions of the same authorization cannot both execute.
  • Design retry and idempotency handling so network failures do not result in either unpaid execution or duplicate paid work.
  • Fail closed on malformed or unexpected facilitator responses, including non-success HTTP status codes, invalid JSON, missing fields, and timeouts.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (3)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description says to use the skill 'when an agent needs to accept per-call USDC payments for a tool or API,' which is a broad capability description rather than a specific trigger phrase or constrained invocation condition. It does not define clear boundaries, exclusions, or example triggers, so multiple unrelated payment-related contexts could match unintentionally.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The sample code performs an outbound POST to https://x402.org/facilitator/verify, transmitting decoded payment payload contents to an external service. Even though this is core to the protocol flow and not obviously malicious, it introduces third-party data exposure and a trust dependency on the verifier; in a payments workflow, that makes the pattern security-relevant rather than a harmless false positive.

Content

Scanner excerpt · SKILL.md (reported line 43)May include surrounding context.

md
"error": "payment required: $0.50 USDC on Base",
        })
    payload = json.loads(base64.b64decode(x_payment).decode())
    r = httpx.post("https://x402.org/facilitator/verify", json={
        "x402Version": 1,
        "paymentPayload": payload,
        "paymentRequirements": REQUIREMENTS,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill instructs the server to send payment payload data to an external verifier (x402.org) without explicitly warning the operator that signed payment metadata will be transmitted off-system. In a payment context, silent third-party transmission can create privacy, compliance, and trust risks, especially if developers copy the pattern without understanding what user or transaction data leaves their boundary.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.