T09 · Insecure Skill Coding Practices
- Location
SKILL.md:199- Finding
SerpAPI Credential Disclosure Through Debug Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 199-205
Vulnerability Type: Secret exposure through console and log output
Risk Level: Highpython try: results = client.search("test query") except Exception as e: print(f"Error details: {e}") # Check environment variables print(f"API Key: {os.getenv('SERP_API_KEY')}")Technical Analysis
The documented troubleshooting procedure prints the complete
SERP_API_KEYenvironment variable. BecauseSKILL.mdsupplies operational instructions for an AI agent, this example may be followed during error diagnosis and is security-relevant even though it is not part of the primary Python executable.Console output can be retained in agent transcripts, CI logs, shell histories, support bundles, monitoring systems, or screen recordings. Printing a credential therefore expands access from the process holding the environment variable to every person or system capable of reading those records.
Attack Path
- A search operation fails, or an attacker causes or alleges a failure.
- The user or agent follows the debugging instructions in
SKILL.md. - The process reads
SERP_API_KEYfrom its environment. - The complete API key is printed to the terminal or agent transcript.
- An attacker with access to the resulting logs or transcript recovers the credential.
- The attacker uses the key against SerpAPI until it is revoked or its quota is exhausted.
Impact Assessment
The exposed credential grants the same SerpAPI access and quota available to the legitimate user. It can be used to consume paid or limited API resources, conduct searches attributed to the victim, and disrupt legitimate operation through quota exhaustion. This does not directly grant operating-system privileges, but compromise extends to all SerpAPI capabilities authorized for the key.
- Remediation
View remediation
Remediation Suggestions
- Remove all output that displays the credential itself.
- Report only whether the variable is configured:
python configured = bool(os.getenv("SERP_API_KEY")) print(f"SERP_API_KEY configured: {configured}") - If identifying a key is operationally necessary, display only a short masked suffix.
- Configure logging filters to redact secret-like environment variables.
- Revoke and rotate any key that may already have appeared in logs or transcripts.
- Add automated secret-output checks to documentation and code review.
