T05 · Unauthorized Access and Privilege Escalation
- Location
SKILL.md:36- Finding
Credential Disclosure Through Documented File Inspection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 36-45
Vulnerability Type: Exposure of a bearer credential through command output
Risk Level: MediumVulnerable code snippet:
markdown ## API密钥与充值 使用此技能需要API密钥。API密钥保存在 `~/.upkuajing/.env` 文件中: ```bash cat ~/.upkuajing/.env文件内容示例:
text UPKUAJING_API_KEY=your_api_key_here未设置API密钥
请先检查
~/.upkuajing/.env文件是否有 UPKUAJING_API_KEY;text ### Technical Analysis The Skill instructs the Agent to run `cat ~/.upkuajing/.env` to determine whether an API key has been configured. This prints the complete contents of a secret-bearing file rather than checking only whether the required variable exists. The resulting bearer token may enter the Agent's context, terminal transcripts, execution logs, monitoring systems, or chat output. Reading the credential value is unnecessary for the declared search functionality because `scripts/common.py` already loads the key internally and can report when it is absent. This behavior exceeds least privilege: the Agent needs to know whether authentication is available, but it does not need to display or retain the credential itself. ### Attack Path 1. A user or Agent follows the documented credential-check procedure. 2. The command prints the complete `.env` file, including `UPKUAJING_API_KEY`. 3. The output is retained in an Agent context, terminal log, transcript, or observability system. 4. A party with access to that output extracts the bearer token. 5. The party submits authenticated requests to the vendor API using the victim's account and balance. ### Impact Assessment Exposure grants the ability to authenticate as the affected API account within the permissions associated with the bearer token. A party possessing the token may issue paid searches, retrieve account information, create payment-related requests, or consume the account balance. This does not directly grant opera ...[truncated 124 chars]- Remediation
View remediation
Remediation Suggestions
- Remove the instruction to print the
.envfile. - Add a dedicated command that reports only whether the key exists, never its value.
- Prefer environment-variable authentication and allow
get_api_key()to report a missing key. - If shell-based checking is unavoidable, ensure that the command produces only a fixed status message.
- Redact bearer tokens from terminal output, Agent context, exception messages, and application logs.
- Rotate any API key that has already appeared in execution transcripts.
- Remove the instruction to print the
