T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/generate.py:57
- Finding
- API Key Exposed Through Subprocess Command-Line Arguments## Vulnerability Details **File Location**: `scripts/generate.py`, lines 57-69 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium **Vulnerable Code**: ```python curl_cmd = [ "curl", "-s", "-X", "POST", f"{API_BASE_URL}/video/submit", "-H", f"Authorization: Bearer {api_key}", "-H", "Content-Type: application/json", "-d", json.dumps(data), "--max-time", "30" ] try: result = subprocess.run(curl_cmd, capture_output=True, text=True) ``` ### Technical Analysis The SiliconFlow bearer token is embedded directly in the argument list passed to the `curl` subprocess. On systems where process arguments are visible through process inspection facilities, monitoring tools, audit logs, or process-listing utilities, another local user or process may observe the complete `Authorization` header while the request is running. Using an argument list avoids shell-command injection, but it does not protect sensitive values from process metadata exposure. The request should instead be made through an in-process HTTPS client so that the credential is carried only in application memory and the encrypted network request. ### Attack Path 1. An attacker obtains local process-observation capability on the machine running the skill. 2. The victim invokes the video-generation script with a valid SiliconFlow API key. 3. The script starts `curl` with `Authorization: Bearer <API_KEY>` in its command-line arguments. 4. The attacker monitors process metadata and captures the authorization argument while `curl` is running. 5. The attacker reuses the captured credential to make unauthorized SiliconFlow API requests. Exploitation requires local process visibility or access to tooling that records command-line arguments. It is not remotely exploitable solely through the prompt or image URL. ### Impact Assessment A successful attacker can obtain the Sili ...[truncated 329 chars]
- Remediation
- ## Remediation Suggestions - Replace the `curl` subprocess with a maintained in-process HTTPS client, such as Python's `urllib.request` or a pinned HTTP library. - Supply the bearer token through the HTTP client's header API rather than through child-process arguments. - Configure explicit connection and response timeouts and validate HTTP status codes and response content. - Ensure exception messages, debug logs, and API error handling never include authorization headers or the raw API key. - If use of `curl` is unavoidable, provide sensitive configuration through a protected mechanism that does not expose it in process arguments, and restrict any temporary configuration file to owner-only permissions with reliable cleanup. - Rotate the API key if there is reason to believe process arguments have already been collected or logged.
