T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Disclosure Through Terminal Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37–46
Vulnerability Type: Credential exposure through unsafe operational instructions
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_hereAPI Key Not Set
First check if the
~/.upkuajing/.envfile has UPKUAJING_API_KEY;text ### Technical Analysis The Skill explicitly instructs the Agent to display the entire credential file with `cat`. Although accessing the API key is required for authenticated requests, exposing its plaintext value through standard output is not necessary. Executing this instruction can place the API key in terminal transcripts, Agent conversation context, command-capture logs, screen recordings, debugging output, or other downstream systems that process command results. The file may also contain additional variables in the future, all of which would be disclosed by the same command. The Python implementation already retrieves the required key internally, so there is no functional need to print the credential file. ### Attack Path 1. A user invokes the Skill without an API key available in the process environment. 2. The Agent follows the instructions in `SKILL.md`. 3. The Agent executes `cat ~/.upkuajing/.env`. 4. The complete API key appears in captured terminal or tool output. 5. A party with access to the transcript, logs, shared display, or Agent context obtains the key. 6. The exposed key is used to issue authenticated and potentially billable API requests. ### Impact Assessment Exploitation does not grant operating-system privileges, but it can disclose the user's UpKuaJing API credential. An attacker could impersonate the credential owner within the API's authorized scope, consume account balance, retriev ...[truncated 261 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to execute
cat ~/.upkuajing/.env. - Check only whether the required variable exists, without printing its value.
- Keep credential retrieval entirely inside the Python client.
- If diagnostic output is necessary, report only whether the key is configured, such as
UPKUAJING_API_KEY is set, without displaying any portion of the value. - Ensure tool and Agent output never contains secrets.
- Update the documentation to prefer process environment variables or a system credential store over plaintext inspection.
- Advise users to rotate any key that has already appeared in terminal, Agent, or application logs.
- Remove the instruction to execute
