T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/keepa.sh:122
- Finding
- Keepa API Key Exposed in Process Arguments and URL Logging<![CDATA[ ## Vulnerability Details **File Location**: `scripts/keepa.sh`, lines 122-126 **Vulnerability Type**: API credential exposure through command-line arguments and URL query parameters **Risk Level**: Medium ### Vulnerable Code ```bash keepa_request() { local endpoint="$1" local params="$2" local url="https://api.keepa.com/${endpoint}?key=${KEEPA_API_KEY}${params}" curl -s --compressed "$url" } ``` ### Technical Analysis The Keepa API key is embedded directly into the request URL passed to `curl`. Although HTTPS encrypts the request in transit, it does not prevent exposure through local process arguments or components that record complete URLs. While `curl` is running, the URL may be visible to other processes or users with sufficient process-inspection permissions. Complete URLs may also be captured by shell tracing, debugging systems, process monitoring, crash diagnostics, proxies, or application logs. The request is restricted to the legitimate Keepa HTTPS endpoint, and no evidence of intentional credential exfiltration was found. Nevertheless, placing a reusable secret in a command-line URL unnecessarily increases its exposure surface. ### Attack Path 1. A victim configures a valid Keepa API key and invokes the script. 2. `keepa_request` constructs a URL containing `key=${KEEPA_API_KEY}`. 3. The script launches `curl` with that complete URL as a command-line argument. 4. A local observer, diagnostic tool, or logging component captures the process arguments or URL. 5. The observer extracts the API key. 6. The exposed key is reused to make unauthorized Keepa API requests. This path requires local process visibility, access to relevant diagnostic data, or access to a component that records URLs. ### Impact Assessment An attacker who obtains the key can authenticate to Keepa as the affected user and consume the account's API tokens or quota. This may cause unexpected charges, quota exhaustion, service disruption, or access to A ...[truncated 197 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. If supported by Keepa, transmit the credential in an authorization header rather than the query string. 2. If Keepa requires a query parameter, prevent the secret from appearing directly in `curl` process arguments. Consider supplying sensitive curl options through a protected configuration stream or file descriptor. 3. Ensure any temporary credential material is created with restrictive permissions, removed reliably, and never written to shared directories. 4. Disable shell tracing around credential handling and avoid printing or logging the complete request URL. 5. Redact the `key` parameter in monitoring, proxy, diagnostic, and error logs. 6. Store configuration files containing API keys with owner-only permissions, such as mode `0600`, or use an operating-system secret manager. 7. Rotate any API key suspected of having appeared in process captures or logs. ]]>
