T09 · Insecure Skill Coding Practices
Note
- Location
- SKILL.md:31
- Finding
- Unsafe Inline API Key Handling in Command Example## Vulnerability Details **File Location**: `SKILL.md`, lines 31–36 **Vulnerability Type**: API credential exposure through command-line arguments **Risk Level**: Low ### Vulnerable Code ```bash curl -s -X POST "https://google.serper.dev/search" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"q": "your query"}' ``` ### Technical Analysis The documentation instructs users to replace `YOUR_API_KEY` with a real Serper API key directly in a shell command. This can expose the credential through shell history and, depending on the operating system and process-isolation configuration, process inspection while `curl` is running. The example contains only a placeholder and therefore does not itself disclose a valid credential. The vulnerability arises when a user follows the documented procedure with a real secret. ### Attack Path 1. A user substitutes a valid Serper API key for `YOUR_API_KEY`. 2. The user runs the resulting command in an interactive shell. 3. The command containing the key may be saved in the user's shell-history file or exposed through local process-inspection mechanisms. 4. An attacker with sufficient local access reads the command or history entry and extracts the key. 5. The attacker submits unauthorized requests to the Serper API using the stolen credential. Exploitation requires local access to relevant process information, shell history, terminal logs, or another command-recording facility. ### Impact Assessment A recovered key could permit unauthorized use of the victim's Serper account and API quota within the permissions assigned to that key. This may cause quota exhaustion, unexpected charges, or unauthorized search activity attributed to the victim. The documented behavior does not grant operating-system privileges, persistence, or arbitrary code execution. The impact is limited to the compromised API credential and its associated service permission ...[truncated 2 chars]
- Remediation
- ## Remediation Suggestions - Remove the inline-key example and document only a protected environment-variable or secret-manager workflow. - Advise users not to paste credentials directly into interactive shell commands. - Prefer a protected configuration file with restrictive permissions or a secret-injection mechanism that does not expose the key in command history. - Ensure diagnostic output and command tracing do not print the `X-API-Key` header. - Recommend rotating the credential immediately if it has been entered into shell history, logs, or other persistent command-recording systems. - If an environment variable is used, avoid enabling shell tracing such as `set -x` while executing the request.
