T09 · Insecure Skill Coding Practices
- Location
SKILL.md:67- Finding
API Key Exposure Through Agent Context and Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:67-70
Vulnerability Type: Unnecessary secret access and insecure credential transmission
Risk Level: HighVulnerable Code
text - If `~/.openclaw/workspace/skills/nano-banana-pro-openrouter/.env` exists: 1. Use the `read` tool to read `.env` 2. Extract `OPENROUTER_API_KEY` and `OPENROUTER_BASE_URL` 3. Always pass the key via `--api-key` when running the scriptTechnical Analysis
The Skill explicitly instructs the Agent to read a credential file, extract the OpenRouter API key into the Agent's context, and pass that secret as a command-line argument.
This access exceeds the minimum privileges needed for image generation. The shell script already loads the Skill-local
.envfile itself, so the Agent does not need to read or process the secret. Passing the key using--api-keymay additionally expose it through process listings, command logging, execution telemetry, shell history, or tool-call records.Attack Path
- A plaintext API key is stored in the Skill's
.envfile. - The Skill instructions direct the Agent to read the entire file.
- The API key enters the Agent and tool execution context.
- The Agent invokes the script with
--api-key KEY. - The key may become visible in process arguments, tool logs, execution history, or diagnostic output.
- A party with access to any of these channels can recover and reuse the credential.
Impact Assessment
Successful exploitation may disclose the OpenRouter API key to other local users, monitoring systems, logs, or parties with access to Agent execution records. A stolen key could be used to consume the victim's API quota, incur charges, or access capabilities associated with the affected OpenRouter account. This does not directly grant operating-system privilege escalation.
- A plaintext API key is stored in the Skill's
- Remediation
View remediation
Remediation Suggestions
- Remove the instructions requiring the Agent to read
.env. - Do not pass API keys through command-line arguments.
- Allow the script to read only its trusted Skill-local
.env, which it already supports. - Alternatively, supply credentials through a protected file descriptor, standard input, or a dedicated secret manager.
- Ensure the credential file has restrictive permissions, such as mode
0600. - Redact authorization data from all execution logs and error reports.
- Remove the instructions requiring the Agent to read
