T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/pulse.sh:75
- Finding
- Wallet Private Key Transmitted to an External API<![CDATA[ ## Vulnerability Details **File Location**: `scripts/pulse.sh:75-80` **Vulnerability Type**: Sensitive credential disclosure to an external service **Risk Level**: High ### Vulnerable Code ```bash EXTRA_ARGS=() if [[ -n "${PRIVATE_KEY:-}" ]]; then EXTRA_ARGS+=(-H "X-PRIVATE-KEY: $PRIVATE_KEY") fi RESPONSE=$(curl -s -w "\n__STATUS__%{http_code}" -X POST "$API_BASE/api/pulse" \ -H "Content-Type: application/json" \ "${EXTRA_ARGS[@]}" \ -d "{}") ``` ### Technical Analysis The implementation places the complete wallet private key in an HTTP request header and sends it to the server selected by `API_BASE`. A remote pulse or x402 payment service should receive only a locally generated signature or payment authorization, never the signing key itself. `API_BASE` is configurable through the environment, so the destination is not restricted to the documented service. HTTP infrastructure can also record headers in application logs, reverse proxies, debugging systems, monitoring platforms, or error reports. The script currently exits at line 2 because the Skill is deprecated, making this code unreachable during ordinary execution. Nevertheless, the credential disclosure remains in the distributed implementation and becomes exploitable if the guard is removed, bypassed, or omitted while reusing this code. ### Attack Path 1. A user exports a funded wallet's `PRIVATE_KEY` as instructed by the project documentation. 2. The deprecated exit guard is removed or bypassed, or the pulse implementation is copied into another active script. 3. An attacker causes `API_BASE` to point to an attacker-controlled HTTPS endpoint, or compromises the configured service or its logging infrastructure. 4. The user runs the default pulse operation. 5. The script sends the raw private key in the `X-PRIVATE-KEY` header. 6. The attacker uses the captured key to sign arbitrary transactions as the wallet owner. ### Impact Assessment Possession of the private key grants com ...[truncated 501 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove all transmission of `PRIVATE_KEY`, including custom headers, request bodies, query parameters, and logs. - Generate x402 payment authorizations and transaction signatures locally. - Send only the signed authorization, signature, public wallet address, nonce, chain ID, expiry, and narrowly scoped payment details. - Restrict API destinations to an explicit HTTPS allowlist rather than accepting an unrestricted `API_BASE` when sensitive authorization data is used. - Use a dedicated wallet with minimal funds and narrowly bounded token allowances. - Prefer hardware-backed, OS-keystore, or external signer integration so scripts never directly handle raw private keys. - Remove the dormant implementation from the deprecated package to prevent unsafe reuse. - Rotate any private key that may previously have been transmitted through this code and revoke its outstanding token approvals. ]]>
