T09 · Insecure Skill Coding Practices
- Location
SKILL.md:52- Finding
API Key Exposed Through Terminal Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:52
Vulnerability Type: Plaintext credential disclosure
Risk Level: HighVulnerable Code
bash echo $DASHSCOPE_API_KEYTechnical Analysis
The documented environment-check procedure prints the complete DashScope API key to standard output. Because agents may execute this instruction during setup, the credential can be retained in terminal history, CI logs, screen recordings, shared consoles, or agent transcripts.
The check only needs to determine whether the variable is set; disclosing its value is unnecessary. Although the project does not hardcode a credential, this instruction can expose a valid user-supplied secret.
Attack Path
- A user or agent follows the mandatory environment-check instructions in
SKILL.md. - The shell expands
DASHSCOPE_API_KEYand prints the full credential. - The output is captured in a transcript, build log, shared terminal, or monitoring system.
- A party with access to that output extracts the key.
- The exposed key is used to submit unauthorized DashScope API requests until it is revoked or expires.
Impact Assessment
An attacker could obtain the API access authorized to the exposed DashScope key. The resulting scope depends on the key's account permissions and may include unauthorized model usage, consumption of paid quota, disclosure of account usage information available through the API, and service disruption through quota exhaustion. This does not directly grant operating-system privileges.
- A user or agent follows the mandatory environment-check instructions in
- Remediation
View remediation
Remediation Suggestions
Replace the value-printing command with a presence-only check:
bash if [ -n "${DASHSCOPE_API_KEY:-}" ]; then echo "DASHSCOPE_API_KEY is set" else echo "DASHSCOPE_API_KEY is not set" fiAdditional hardening measures:
- Explicitly instruct users never to paste or print API keys in agent conversations.
- Prefer environment variables or a protected secret manager over the
--api-keycommand-line option. - Redact credentials from application and CI logs.
- Rotate any key that may already have been printed.
- Configure usage limits and monitoring to detect unauthorized API consumption.
