T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
API Key May Be Exposed Through Direct File Output
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 45-58
Vulnerability Type: Credential disclosure through Agent-visible output
Risk Level: HighVulnerable Code
bash cat ~/.upkuajing/.envThe surrounding instructions direct the Agent to inspect this file when verifying whether
UPKUAJING_API_KEYis configured.Technical Analysis
The
.envfile contains the complete bearer API key. Printing the file is not necessary because the implementation inscripts/common.pycan retrieve the credential directly from the process environment or the dedicated configuration file.Executing the documented command places the plaintext credential in command output. Depending on the Agent runtime, that output may subsequently be included in model context, chat transcripts, execution logs, telemetry, debugging records, or other storage with a broader audience than the original credential file.
This behavior exceeds minimum privilege. The Skill only needs to determine whether the expected key exists and use it as an authorization header; it does not need to reveal the key to the Agent or user.
Attack Path
- A user invokes the Skill without an API key available in the process environment.
- The Agent follows the Skill documentation and executes the documented
catcommand. - The entire
.envfile, includingUPKUAJING_API_KEY, is returned through tool output. - The plaintext key enters the Agent context or associated logs and transcripts.
- A party with access to those records obtains the bearer token.
- The exposed token is reused against the provider API for authenticated operations, including potentially chargeable requests and account-information retrieval.
Impact Assessment
Successful exploitation discloses a reusable bearer credential. The attacker obtains the same provider API privileges assigned to the key, potentially including paid email-validation requests, account-inf ...[truncated 278 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove all instructions that print the
.envfile or its contents. - Check only whether the variable exists and is non-empty, without returning its value.
- Prefer injecting
UPKUAJING_API_KEYthrough the Agent platform's secret-management mechanism. - If status must be displayed, return only a boolean result or a heavily masked identifier.
- Never ask users to paste the complete API key into a conversation.
- Ensure command output, exception messages, request logs, and telemetry redact authorization values.
- Update the instructions to state that credential configuration must occur outside the conversational context.
- Remove all instructions that print the
