T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:40- Finding
Credential File Disclosure Through Full-File Inspection Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 40-49
Vulnerability Type: Credential disclosure and excessive secret-file access
Risk Level: HighVulnerable 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 print the complete contents of a credential file to determine whether one specific variable exists. Although access to the UpKuaJing API key is necessary for authenticated requests, displaying the entire file is not required. The command can disclose the API key and any unrelated secrets stored in the same file. The output may subsequently be captured in the Agent conversation, terminal scrollback, execution logs, monitoring systems, or other retained output. This exceeds least privilege because a non-disclosing existence check would be sufficient. The Python implementation in `scripts/common.py` can retrieve the required key without printing it, so the full-file display instruction is unnecessary for the declared alumni-query functionality. ### Attack Path 1. A user invokes the Skill without an API key present in the process environment. 2. The Agent follows the documented instruction and runs `cat ~/.upkuajing/.env`. 3. The complete file contents are returned to the Agent or terminal. 4. The API key and any additional secrets in that file become part of visible or retained output. 5. A user, observer, log reader, or compromised Agent context obtains the disclosed credentials. 6. The exposed API key can be reused to make authenticated and potentially billable requests. ### Impact Assessment Exploitation exposes secrets available in `~/.upkuajing/.env`; it does no ...[truncated 359 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the
cat ~/.upkuajing/.envinstruction. - Check only whether the required variable exists and is nonempty, without printing its value.
- Prefer the existing
get_api_key()implementation or a dedicated status-check command that returns only a Boolean result. - Never include complete or partially revealed API keys in Agent output, logs, exceptions, or command examples.
- Advise users to keep unrelated credentials in separate files so compromise of one service configuration does not expose other services.
- If diagnostic output is required, return a message such as
UPKUAJING_API_KEY is configuredrather than the value.
- Remove the
