T09 · Insecure Skill Coding Practices
- Location
summarize.sh:35- Finding
Anthropic API Key Exposed Through Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
summarize.sh, lines 35–47
Vulnerability Type: Secret exposure through command-line arguments
Risk Level: MediumVulnerable Code
bash RESPONSE=$(curl -s https://api.anthropic.com/v1/messages \ -H "content-type: application/json" \ -H "x-api-key: $ANTHROPIC_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -d "{ \"model\": \"claude-sonnet-4-20250514\", \"max_tokens\": 1500, \"messages\": [{ \"role\": \"user\", \"content\": $FULL_CONTENT }] }" 2>/dev/null)Technical Analysis
The
ANTHROPIC_API_KEYenvironment variable is expanded into curl's-Hcommand-line argument. Consequently, the completex-api-keyheader can appear in curl's process argument vector while the request is in progress.On systems where process arguments are visible to other users or processes through tools such as
psor interfaces such as/proc/<pid>/cmdline, a local attacker may observe and recover the credential. Exploitation depends on the operating system's process-isolation configuration, the attacker's local access, and their ability to inspect the process during the relatively short request window.This is an insecure secret-handling practice rather than evidence of intentional credential theft. The credential is sent only to the documented Anthropic API endpoint, which is necessary for the declared API-backed summarization functionality.
Attack Path
- A victim configures
ANTHROPIC_API_KEYand invokessummarize.sh. - The script expands the credential into the
x-api-keycurl header argument. - While curl is running, a local attacker repeatedly monitors process argument vectors.
- If process arguments are visible under the host's access-control policy, the attacker extracts the API key from the header argument.
- The attacker reuses the key to submit unauthorized requests to the Anthropic API unt ...[truncated 513 chars]
- A victim configures
- Remediation
View remediation
Remediation Suggestions
- Do not place authentication secrets directly in command-line arguments.
- Provide the sensitive header through a permission-restricted curl configuration supplied by a protected file descriptor or temporary file, where supported.
- If a temporary file is unavoidable, create it with permissions limited to the current user, install an
EXITtrap before writing the secret, and remove the file on every exit path. - Run the Skill under a dedicated, least-privileged account and configure the host to restrict cross-user process inspection.
- Use a dedicated API key with minimum required permissions, provider-side spending limits, monitoring, and regular rotation.
- Revoke and replace the key immediately if process monitoring or logs may have captured it.
- Explicitly document that meeting transcripts are transmitted to
https://api.anthropic.com/v1/messages, because transcripts may contain confidential business or personal information.
