T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:140- Finding
API Credential Disclosure Through Skill Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 140-151
Vulnerability Type: Unnecessary disclosure of a plaintext API credential to the Agent session
Risk Level: HighVulnerable Code
markdown This Skill requires an API key stored in `~/.upkuajing/.env`: ```bash cat ~/.upkuajing/.envtext UPKUAJING_API_KEY=your_api_key_hereIf the API key is not configured, first inspect
~/.upkuajing/.envforUPKUAJING_API_KEY.text The quoted text is an English rendering of the original Skill instructions; the command and credential name are unchanged. ### Technical Analysis The instructions direct the Agent to run `cat ~/.upkuajing/.env`. This prints the entire credential file into command output. In an Agent environment, tool output may be copied into the active conversation, model context, execution logs, observability systems, or retained transcripts. Displaying the credential is not required for authenticated requests. The implementation in `scripts/common.py` can retrieve the expected key internally without printing its value. The instruction therefore exceeds the minimum access necessary for the declared functionality. The command also prints every other value that might be added to the same file, not only `UPKUAJING_API_KEY`. ### Attack Path 1. A user asks the Agent to use an authenticated Skill function. 2. The Agent follows `SKILL.md` and executes `cat ~/.upkuajing/.env`. 3. The complete file, including the API key, is returned as tool output. 4. The credential enters the Agent context or associated logs. 5. A party with access to those records can reuse the key against the UpKuaJing API. ### Impact Assessment Disclosure may allow unauthorized authenticated API requests, use of paid services, access to account information, access to email or SMS task records, merchant searches, contact validation, and unauthorized outreach. The precise scope depends on the ser ...[truncated 49 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the
cat ~/.upkuajing/.envinstruction. - Check only whether the expected variable exists and is nonempty; never print its value.
- Prefer an injected process environment or operating-system secret manager over a plaintext file.
- If a file fallback remains necessary, provide a helper that returns only a Boolean configuration status.
- Ensure error messages never include the key or the contents of the credential file.
- Document that users must not paste API keys into chat messages or Agent command arguments.
- Remove the
