T09 · Insecure Skill Coding Practices
- Location
SKILL.md:38- Finding
Credential Disclosure Through Documented Plaintext File Display
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 38–47
Vulnerability Type: Credential exposure through unnecessary plaintext output
Risk Level: MediumVulnerable Code Snippet
The instructions identify the credential file and direct the Agent to display its complete contents:
bash cat ~/.upkuajing/.envThe documented file content is:
text UPKUAJING_API_KEY=your_api_key_hereThe surrounding instructions require checking this file for
UPKUAJING_API_KEY.Technical Analysis
Reading
UPKUAJING_API_KEYis necessary for the authenticated trade-analysis API. Displaying the entire credential file is not necessary to determine whether the variable exists.If the Agent follows the documented command, the plaintext API key may enter terminal output, Agent conversation context, command transcripts, screen recordings, CI logs, or other monitoring systems. This exceeds the minimum access required by the Skill because a non-disclosing existence check would provide the same operational result.
The code does not send the key to an unrelated domain. Authenticated requests use the fixed HTTPS endpoint
https://openapi.upkuajing.com. The issue is unnecessary local disclosure rather than confirmed credential exfiltration.Attack Path
- A user or Agent follows the environment setup procedure in
SKILL.md. - The command
cat ~/.upkuajing/.envis executed. - The complete API key is printed to standard output.
- Terminal logging, Agent context retention, screen sharing, or another local observer captures the output.
- An unauthorized party reuses the Bearer credential to invoke authenticated platform APIs.
Impact Assessment
A disclosed key may allow unauthorized use of the associated API account. Based on the audited scripts, accessible operations can include billable trade queries, retrieval of account information, creation of recharge orders, pricing requests, an ...[truncated 235 chars]
- A user or Agent follows the environment setup procedure in
- Remediation
View remediation
Remediation Suggestions
-
Remove the instruction to display the complete
.envfile. -
Use a non-disclosing presence check, for example:
bash grep -q '^UPKUAJING_API_KEY=.' ~/.upkuajing/.env -
Prefer checking whether the environment variable is set without printing its value:
bash test -n "${UPKUAJING_API_KEY:-}" -
Instruct users to configure credentials directly rather than supplying them through Agent messages.
-
Ensure error messages report only whether a credential is missing or invalid and never include the credential value.
-
Advise users to rotate any key that has already appeared in terminal logs, chat context, or other retained output.
-
