T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
API Key Disclosure Through Documented Terminal Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 37-43
Vulnerability Type: Plaintext credential exposure
Risk Level: MediumVulnerable Code
markdown The API key is stored in the `~/.upkuajing/.env` file: ```bash cat ~/.upkuajing/.envExample file contents:
text UPKUAJING_API_KEY=your_api_key_heretext ### Technical Analysis The documented setup procedure instructs the Agent or user to print the entire credential file to standard output. This operation is unnecessary for checking whether the required key exists. Standard output may be retained in Agent conversation context, command-execution logs, terminal scrollback, CI logs, screen recordings, telemetry, or debugging records. Consequently, the instruction can move the complete API key from a protected file into less-protected output channels. Internal access to the specific `UPKUAJING_API_KEY` value is necessary for authenticated API requests, but exposing the value in terminal output exceeds the minimum privilege and disclosure requirements of the Skill. ### Attack Path 1. A user or Agent follows the credential setup instructions. 2. The documented `cat ~/.upkuajing/.env` command is executed. 3. The complete API key is printed to standard output. 4. The output is captured in Agent context, execution logs, terminal history, telemetry, or a recording. 5. A party with access to that output extracts the key. 6. The exposed key is reused against the Upkuajing API for authenticated and potentially billable operations. ### Impact Assessment Exploitation does not grant operating-system privilege escalation, but it may grant the attacker the API privileges assigned to the compromised key. This can include unauthorized billable queries, access to account-related API information, diagnostic submissions, and creation of payment-order URLs. The scope is limited to the affected Upkuajing API account and the permissions a ...[truncated 33 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to run
cat ~/.upkuajing/.env. - Check only whether the required variable exists and is non-empty without displaying its value.
- Provide a dedicated status command that returns a boolean or a masked value such as
UPKUAJING_API_KEY=********. - Prevent credentials from being included in Agent-visible output, debug logs, error messages, or command transcripts.
- If a key has already appeared in captured output, rotate it and remove the exposed value from retained logs where feasible.
- Remove the instruction to run
