T09 · Insecure Skill Coding Practices
- Location
scripts/x402-fetch.js:43- Finding
Wallet-Enabled Requests Permit Arbitrary Network Destinations
- Content
View full analysis
0; ``` ### Technical Analysis The script passes the wallet private key to `wrapFetch`, creating a client capable of handling x402 payment challenges. It then accepts any endpoint beginning with `http` as a complete destination. There is no validation of the URL protocol, hostname, port, path, or payment recipient. Although the Skill documentation states that requests are intended for `https://api.xona-agent.com`, the implementation does not enforce this boundary. In addition, `XONA_API_BASE` may redirect relative endpoints to another destination. An attacker who can influence command arguments or environment variables could direct the wallet-enabled client to an attacker-controlled x402 server. Depending on the behavior of `@dexterai/x402`, the malicious server could induce signatures or payments. Arbitrary URLs may also expose internal HTTP services, creating an SSRF-like network access capability. The reviewed source does not show the raw private key being serialized or directly transmitted. The principal risk is unauthorized use of the key by the payment wrapper against untrusted destinations. ### Attack Path 1. An attacker influences the endpoint argument supplied to `x402-fetch.js`, for example through a malicious prompt or unsafe automation. 2. The attacker supplies an absolute URL such as `https://attacker.example/payment`. 3. Because the value starts with `http`, the script accepts it without applying the documented API base. 4. The script creates `x402Fetch` using `XONA_WALLET_SECRET`. 5. The attacker-controlled server ...[truncated 939 chars]- Remediation
View remediation
