T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Exposure Through Credential File Display Instruction
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:37-46
Vulnerability Type: Credential disclosure
Risk Level: Mediummarkdown 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 explicitly instructs the Agent to run `cat ~/.upkuajing/.env`. This prints the complete credential file rather than merely checking whether the required variable exists. Reading the API key internally is necessary for authenticated requests, but displaying it is not required for the declared trade-summary functionality. Command output may become visible in terminal history, Agent context, conversation transcripts, execution logs, monitoring systems, or debugging records. The file could also contain additional variables beyond `UPKUAJING_API_KEY`, all of which would be exposed by the command. ### Attack Path 1. A user or Agent follows the documented API-key setup workflow. 2. The Agent executes `cat ~/.upkuajing/.env`. 3. The complete API key is emitted into the command output and potentially retained in Agent or platform logs. 4. A party with access to those outputs retrieves the exposed key. 5. The party reuses the key in the `Authorization: Bearer` header when calling UpKuaJing APIs. 6. The compromised credential can then be used until it is revoked or replaced. ### Impact Assessment An attacker obtaining the key could perform authenticated operations permitted by the UpKuaJing account, including paid customs-data requests, retrieval of account information, error-report submission, and creation of top-up payment orders. This does not directly grant operating-system privileges, but it can cause billing abuse, account-data exposure, and unauthorized ...[truncated 45 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to display the credential file.
- Check only whether the required variable is present and non-empty, without printing its value.
- Prefer checking the process environment before accessing a file.
- If a file check is necessary, use a command or helper that returns only a Boolean status.
- Prevent API keys from being included in Agent responses, logs, exception messages, and command transcripts.
- Document credential rotation procedures in case a key is accidentally exposed.
- Ensure the file parser retrieves only
UPKUAJING_API_KEYrather than exposing or propagating unrelated entries.
