T09 · Insecure Skill Coding Practices
- Location
SKILL.md:88- Finding
API Credentials Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 88–101 and 137–154
Vulnerability Type: API credential exposure through shell-expanded command-line arguments
Risk Level: MediumVulnerable Code
bash # For Anthropic: curl -s -o /dev/null -w "%{http_code}" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ https://api.anthropic.com/v1/models # For OpenAI: curl -s -o /dev/null -w "%{http_code}" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ https://api.openai.com/v1/models # For Google: curl -s -o /dev/null -w "%{http_code}" \ "https://generativelanguage.googleapis.com/v1beta/models?key=$GOOGLE_API_KEY"The embedded health-check script repeats the same unsafe pattern:
bash STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ -H "x-api-key: ${ANTHROPIC_API_KEY}" \ -H "anthropic-version: 2023-06-01" \ https://api.anthropic.com/v1/models 2>/dev/null) STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ -H "Authorization: Bearer ${OPENAI_API_KEY}" \ https://api.openai.com/v1/models 2>/dev/null) STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ "https://generativelanguage.googleapis.com/v1beta/models?key=${GOOGLE_API_KEY}" 2>/dev/null)Technical Analysis
The shell expands each environment variable before starting
curl. The resulting API credential becomes part of the process argument vector, either in a header argument or, for Google, directly in the request URL. Depending on operating-system process visibility and local security policy, another local user, privileged monitoring agent, diagnostic collector, or compromised process may observe these arguments while the command runs.Embedding the Google API key in the query string introduces additional exposure risk because URLs are more likely than headers to be recorded by proxies, telemetry systems, debugging tools, or request logs.
No hardcoded credentials were found, and the requests target official HTTPS provider endp ...[truncated 1324 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not expand API credentials directly into command-line arguments.
- Supply sensitive headers through a temporary
curlconfiguration file created with restrictive permissions such as mode0600, and securely remove it immediately after use. - Prefer provider-supported credential helpers, protected configuration files, or another mechanism that does not expose secrets in the process argument vector.
- Avoid placing credentials in URL query strings where the provider offers a secure header-based authentication mechanism.
- Disable unnecessary command tracing and ensure diagnostic tooling does not log secret-bearing configuration.
- Apply provider-side least privilege, quota limits, source restrictions where supported, short credential lifetimes, and routine key rotation.
- If these commands have already been used on a system where process arguments or URLs are collected, review relevant telemetry and logs and rotate potentially exposed keys.
