T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:18
- Finding
- Brave API Key Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 18-20 **Vulnerability Type**: Secret exposure through command-line arguments **Risk Level**: Medium ```bash # Option A: Via config.patch (key will be stored securely) openclaw gateway config.patch --raw '{"tools":{"web":{"search":{"apiKey":"YOUR_BRAVE_API_KEY","enabled":true,"provider":"brave"}}}}' ``` ### Technical Analysis The instructions encourage users to replace `YOUR_BRAVE_API_KEY` with a real credential inside a command-line argument. Although the destination configuration may store the key securely, the command used to populate it can expose the credential before storage. The complete command may be retained in shell history and can potentially be observed in process listings while it is executing. Terminal-session recording, diagnostic collection, shell-history synchronization, or backup software could also capture it. This conflicts with the comment claiming that the key “will be stored securely,” because only the final storage location is addressed, not the insecure transmission through the shell command. No evidence indicates that the Skill sends this key to an unauthorized remote endpoint. The issue is local credential disclosure caused by unsafe secret handling. ### Attack Path 1. A user replaces `YOUR_BRAVE_API_KEY` with a valid Brave API key. 2. The user executes the documented `openclaw gateway config.patch` command. 3. The command containing the plaintext key is recorded in shell history or briefly exposed through process inspection. 4. A local account, support bundle, terminal recorder, history backup, or malware with access to that data obtains the key. 5. The exposed credential is used to submit unauthorized Brave Search API requests. ### Impact Assessment An attacker who recovers the key can act within the permissions and quota assigned to that Brave API credential. Likely consequences include unauthorized API consumption, quota depletion, billing impact where ...[truncated 199 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Do not place API keys directly in command-line arguments. - Prefer an interactive secret prompt that disables terminal echo and passes the value through standard input or a protected file descriptor. - If OpenClaw supports environment-variable expansion or secret references, document that mechanism instead of literal substitution. - If a temporary credential file is unavoidable, create it with permissions set to `0600`, avoid predictable paths, and delete it immediately after use. - Warn users not to save credentials in shell history and provide explicit credential-rotation instructions for keys that may already have been exposed. - Revise the “stored securely” comment to clarify that both input handling and storage must be protected. ]]>
