T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Exposure Through Full Credential File Display
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37-43
Vulnerability Type: Plaintext secret disclosure through command 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_heretext ### Technical Analysis The instructions direct the Agent to display the entire contents of the credential file with `cat`. The Skill only needs to determine whether `UPKUAJING_API_KEY` exists and then use its value internally; exposing the value in command output is unnecessary. Command output may be retained in Agent context, execution transcripts, terminal logs, monitoring systems, or debugging records. If the file later contains additional configuration secrets, the command will expose those values as well. This exceeds minimum privilege because checking for the presence of one named credential does not require revealing the credential to the Agent response or user-facing output. ### Attack Path 1. A user or Agent follows the documented API-key setup procedure. 2. The Agent executes `cat ~/.upkuajing/.env`. 3. The plaintext API key appears in command output and potentially enters conversation or execution logs. 4. An attacker with access to those records extracts the key. 5. The attacker submits authenticated requests to the UpKuaJing API using the stolen Bearer token. ### Impact Assessment A disclosed key could permit unauthorized requests under the victim's API identity. Based on the audited functionality, this may include consuming paid API balance, accessing associated account information, creating payment-order URLs, and submitting authenticated API queries or error reports. This does not directly grant operating-system privileges, but it compromises the privileges assigned to the affected API credential.- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to run
cat ~/.upkuajing/.env. - Check only whether the named variable exists, without printing its value.
- Prefer a dedicated helper that returns a boolean or masked status.
- Never place the complete key in Agent responses, command transcripts, exceptions, or logs.
- If a diagnostic display is necessary, reveal only a minimal masked suffix and require explicit user approval.
- Document that
~/.upkuajing/.envmust contain only the expected service configuration and must not be copied into support reports.
- Remove the instruction to run
