T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:16
- Finding
- API Key Exposed by Prerequisite Verification Command<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 16 **Vulnerability Type**: Sensitive credential disclosure **Risk Level**: Medium ### Vulnerable Code ```markdown Before running any FreeRide command, ensure: 1. **OPENROUTER_API_KEY is set.** Check with `echo $OPENROUTER_API_KEY`. If empty, the user must get a free key at https://openrouter.ai/keys and set it: ```bash export OPENROUTER_API_KEY="sk-or-v1-..." # Or persist it: openclaw config set env.OPENROUTER_API_KEY "sk-or-v1-..." ``` ``` ### Technical Analysis The instruction directs the agent or user to print the complete `OPENROUTER_API_KEY` value. Although checking that the environment variable exists is necessary, revealing its content is not. Terminal output may be retained in agent transcripts, CI logs, shell recordings, observability systems, screenshots, or support diagnostics. The implementation otherwise handles the key as an authentication credential, sending it as a Bearer token only to OpenRouter. Printing it therefore introduces an unnecessary disclosure channel and exceeds the minimum access needed to verify configuration. ### Attack Path 1. A user invokes the Skill or asks the agent to configure FreeRide. 2. The agent follows the prerequisite instructions in `SKILL.md`. 3. The agent executes `echo $OPENROUTER_API_KEY`. 4. The complete API key appears in terminal output or the agent transcript. 5. Another user, process, logging operator, or compromised integration with access to that output obtains the key. 6. The exposed key is used to authenticate requests against the victim's OpenRouter account. ### Impact Assessment An attacker who obtains the key may make authenticated OpenRouter API requests under the victim's account. The practical scope depends on the permissions, limits, credits, and account configuration associated with that key. Potential consequences include quota consumption, unexpected ...[truncated 275 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Replace the value-printing check with a presence-only test: ```bash if test -n "${OPENROUTER_API_KEY:-}"; then echo "OPENROUTER_API_KEY is set" else echo "OPENROUTER_API_KEY is not set" fi ``` - Explicitly instruct agents never to print, log, or include the key in conversation output. - Avoid displaying even partially masked credentials unless operationally necessary. - Recommend revoking and regenerating any key that has already appeared in logs or transcripts. - Where supported, store the credential in a dedicated secret store rather than plaintext configuration. ]]>
