T09 · Insecure Skill Coding Practices
- Location
SKILL.md:39- Finding
Credential File Contents Are Printed During API Key Validation
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 39-48
Vulnerability Type: API credential disclosure through terminal and agent output
Risk Level: MediumVulnerable Code
markdown This skill requires an API key. The API key is stored in the `~/.upkuajing/.env` file: ```bash cat ~/.upkuajing/.envExample file content:
text UPKUAJING_API_KEY=your_api_key_hereAPI Key Not Set
First check if the
~/.upkuajing/.envfile has UPKUAJING_API_KEY;text ### Technical Analysis The Skill instructs the agent to run `cat ~/.upkuajing/.env` when checking whether the required API key is configured. This prints the entire credential file instead of checking only whether the named variable exists. Terminal output may be captured in agent context, conversation transcripts, execution logs, observability platforms, or shell history-related tooling. The file could also contain additional credentials beyond `UPKUAJING_API_KEY`, all of which would be exposed by this command. Reading the specific UpKuaJing API key internally is necessary to authenticate requests. Printing the complete credential file is not necessary and exceeds the minimum access behavior required by the declared school-detail lookup. ### Attack Path 1. A user invokes the Skill without an API key already present in the process environment. 2. The agent follows the documented setup procedure and executes `cat ~/.upkuajing/.env`. 3. The API key and any other values in the file are written to observable command output. 4. That output is retained in an agent transcript, terminal log, monitoring system, or other accessible execution record. 5. A party able to access the retained output extracts the Bearer token. 6. The exposed token is reused against UpKuaJing endpoints for authenticated and potentially billable operations. ### Impact Assessment Disclosure provides access equivalent to the exposed UpKuaJing API k ...[truncated 424 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to print the
.envfile. - Prefer checking the process environment without displaying the value.
- If the fallback file must be checked, parse it internally and report only whether
UPKUAJING_API_KEYis present. - Never include the full key in standard output, standard error, agent messages, or logs.
- If key identification is necessary, display only a short, non-sensitive suffix rather than the beginning of the token.
- Add explicit documentation warning users not to paste API keys into conversations or command output.
- Review existing transcripts and logs produced by this workflow and rotate any key that may have been exposed.
- Remove the instruction to print the
