T09 · Insecure Skill Coding Practices
- Location
scripts/recognize.py:80- Finding
Recovered API Key Is Disclosed in Diagnostic Output
- Content
View full analysis
> ~/.openclaw/.env", file=sys.stderr) ``` ### Technical Analysis The script retrieves an existing DashScope API key from OpenClaw configuration and interpolates the complete credential into a persistence command printed to stderr. Although stderr is intended for diagnostic output, agent runtimes, CI systems, terminal recorders, monitoring systems, and support bundles commonly retain it. Consequently, a credential originally stored in a configuration file can be copied into additional and potentially less protected logging systems. Displaying the complete key is not necessary for image recognition or credential discovery. The script can provide persistence guidance using a placeholder without exposing the recovered value. ### Attack Path 1. A valid API key exists in one of the supported fields in `~/.openclaw/openclaw.json`. 2. The `.env` file does not exist or does not contain the string `DASHSCOPE_API_KEY`. 3. The user or agent invokes the image-recognition script. 4. The script retrieves the key and prints it verbatim to stderr as part of an `echo` command. 5. An agent platform, CI runner, terminal recorder, or diagnostic collector retains stderr. 6. A party with access to the retained output extracts and reuses the API key. ### Impact Assessment An attacker who obtains the disclosed key may authenticate to DashScope with the permissions associated with that credential, consume paid API quota, submit infere ...[truncated 280 chars]- Remediation
View remediation
