T09 · Insecure Skill Coding Practices
- Location
SKILL.md:66- Finding
Secrets Are Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:66-69;references/env-injection-examples.md:13-16, 41-43, 52-56, 86-91
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: Medium
Category: T09: Insecure Skill Coding PracticesVulnerable Code
SKILL.md:66-69:bash MY_SERVICE_API_KEY="$MY_SERVICE_API_KEY" curl -s \ -H "Authorization: Bearer $MY_SERVICE_API_KEY" \ https://api.myservice.com/v1/datareferences/env-injection-examples.md:13-16:bash curl -s https://api.openai.com/v1/chat/completions \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello"}]}'references/env-injection-examples.md:41-43:bash curl -s https://api.stripe.com/v1/customers \ -u "$STRIPE_SECRET_KEY:"references/env-injection-examples.md:52-56:bash curl -s -X POST https://slack.com/api/chat.postMessage \ -H "Authorization: Bearer $SLACK_BOT_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"channel\":\"#general\",\"text\":\"Hello\"}"references/env-injection-examples.md:86-91:bash curl -s -X POST "https://api.twilio.com/2010-04-01/Accounts/$TWILIO_ACCOUNT_SID/Messages.json" \ --data-urlencode "From=+15551234567" \ --data-urlencode "To=+15559876543" \ --data-urlencode "Body=Hello" \ -u "$TWILIO_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"Technical Analysis
The shell expands the referenced environment variables before starting
curl. Consequently, bearer tokens, API keys, and basic-auth credentials become literal values in thecurlprocess argument vector.Environment injection prevents credentials from being hardcoded in Skill text, but it does not make secrets safe when they are subsequently interpolated into command-line options such as
-Hor-u. Depending on operating-sy ...[truncated 2373 chars]- Remediation
View remediation
Remediation Suggestions
- Do not present
curl -H "Authorization: Bearer $TOKEN"orcurl -u "$SECRET:"as fully secret-safe. Explicitly document that shell expansion places these values in process arguments. - Prefer service clients or application code that reads credentials directly from inherited environment variables and constructs authorization headers internally.
- Where a supported official CLI automatically reads a documented environment variable, use that mechanism rather than passing the credential as an option.
- If
curlis unavoidable, provide an operating-system-appropriate pattern that supplies sensitive configuration through a protected file descriptor or another non-argument input channel. Avoid persistent temporary credential files; if a temporary file is indispensable, create it with mode0600, prevent logging, and delete it reliably with a cleanup trap. - Run commands under a dedicated least-privileged account and restrict process inspection, telemetry collection, and access to diagnostic logs.
- Use narrowly scoped, short-lived credentials and rotate any credential suspected of appearing in command-line telemetry.
- Revise the comments in
SKILL.mdso they distinguish protection from LLM-context disclosure from protection against local host-level process observation.
- Do not present
