T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Credential File Contents Are Printed During Setup
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37-49
Vulnerability Type: Credential disclosure through Agent-visible command output
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_heretext ### Technical Analysis The setup instructions direct the Agent to print the entire credential file. Although reading `UPKUAJING_API_KEY` is necessary for authenticated requests, displaying the file is not necessary and exceeds minimum privilege. Command output may be copied into Agent context, chat transcripts, terminal logs, CI logs, or observability systems. The command also exposes every other secret that may be stored in the same file, not only the required API key. ### Attack Path 1. A user or Agent enters the API-key setup or troubleshooting workflow. 2. The documented `cat ~/.upkuajing/.env` command is executed. 3. The complete bearer token is emitted to captured command output. 4. A party with access to the transcript or logs extracts the token. 5. The token is reused to access account information or make paid API requests. ### Impact Assessment An exposed token can grant the attacker the same UpKuaJing API privileges as the user, including authenticated searches, account-information access, payment-order creation, and other paid operations available to the credential. This does not grant operating-system privilege escalation, but it compromises the external API account and its balance.- Remediation
View remediation
Remediation Suggestions
- Remove all instructions that print the credential file.
- Test only whether the required variable exists, without displaying its value.
- Use the existing
get_api_key()routine for programmatic validation. - Store only
UPKUAJING_API_KEYin the dedicated credential file. - Explicitly warn that credentials must never be pasted into chat or diagnostic output.
- Recommend file mode
0600and directory mode0700.
