T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API key disclosure through documented credential-file output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37-40
Vulnerability Type: Exposure of authentication credentials through terminal output
Risk Level: MediumVulnerable Code Snippet
markdown This skill requires an API key. The API key is stored in the `~/.upkuajing/.env` file: ```bash cat ~/.upkuajing/.envtext ### Technical Analysis The documented command prints the complete contents of the credential file to standard output. The Skill only needs to determine whether `UPKUAJING_API_KEY` exists and then use its value internally; displaying the value is unnecessary. The output may become part of an Agent conversation, terminal history, execution logs, screen recording, or support transcript. Moreover, the command exposes every value in the file, not only the UpKuaJing API key. ### Attack Path 1. A user or Agent follows the setup instructions. 2. The command `cat ~/.upkuajing/.env` is executed. 3. The API key is printed into an observable or retained output channel. 4. A party with access to that channel obtains the credential. 5. The exposed key is reused to make authenticated and potentially billable requests to the UpKuaJing API. ### Impact Assessment An attacker who obtains the key may act within the authorization scope assigned to that UpKuaJing credential. This can include consuming paid API services, retrieving associated account information, creating top-up payment orders, or exhausting the account balance. This does not provide operating-system privilege escalation, but it compromises the external service account represented by the key.- Remediation
View remediation
Remediation Suggestions
- Remove the command that prints the complete credential file.
- Prefer the existing internal
get_api_key()mechanism, which can check the environment and designated file without displaying the secret. - If a setup check is required, use a presence-only check that returns only whether the variable is configured.
- Explicitly instruct Agents and users never to print, echo, log, or include the API key in conversation output.
- Redact credentials from diagnostic output and support reports.
- Recommend rotating any key that has already appeared in logs, transcripts, screenshots, or terminal output.
