T09 · Insecure Skill Coding Practices
- Location
evals/run_evals.py:6- Finding
API Key Exposed Through Process Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
evals/run_evals.py, lines 6–8
Vulnerability Type: API credential exposure through process arguments
Risk Level: MediumVulnerable Code
python python run_evals.py --api-key $ANTHROPIC_API_KEY python run_evals.py --scenario CTC-001 --api-key $ANTHROPIC_API_KEY python run_evals.py --verbose --api-key $ANTHROPIC_API_KEYTechnical Analysis
The documented commands instruct users to pass
ANTHROPIC_API_KEYas a command-line argument. The shell expands the environment variable before starting Python, placing the plaintext credential in the process argument vector.Depending on the operating system and deployment environment, process arguments may be accessible to other local users, process-monitoring utilities, CI/CD telemetry, container orchestration systems, diagnostic collectors, shell tracing, or error-reporting services. This creates an avoidable credential-disclosure channel even though the key originally resides in an environment variable.
Attack Path
- A user exports a valid
ANTHROPIC_API_KEYand runs one of the documented commands. - The shell expands
$ANTHROPIC_API_KEYto its plaintext value. - The expanded key is included in the Python process argument vector.
- A local observer, monitoring service, CI runner, or diagnostic collector captures the command-line arguments.
- The exposed credential is reused to make unauthorized API requests.
Impact Assessment
An attacker who obtains the key may consume the associated API quota, incur charges, access API capabilities granted to the credential, and disrupt legitimate evaluations through rate-limit or budget exhaustion. The precise scope is limited by the permissions, spending limits, and account configuration associated with the exposed key. This issue does not directly provide operating-system privilege escalation.
- A user exports a valid
- Remediation
View remediation
Remediation Suggestions
- Remove
--api-key $ANTHROPIC_API_KEYfrom all usage examples. - Have the evaluation framework read
ANTHROPIC_API_KEYdirectly from the environment without copying it intosys.argv. - Prefer an operating-system or CI secret provider for automated execution.
- Ensure verbose output, exceptions, and telemetry redact authentication values.
- If interactive entry is necessary, use a non-echoing prompt such as Python's
getpassrather than a command-line option. - Rotate any key that may already have appeared in process telemetry or logs.
- Apply least-privilege permissions, spending limits, and usage alerts to evaluation credentials.
- Remove
