T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
API Keys Are Accepted Through Chat Messages
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:33-45
Vulnerability Type: Plaintext secret exposure through conversational input
Risk Level: MediumVulnerable Code Snippet
markdown ### Method 3: Pass directly as a parameter Provide it directly in the request: `Please use API Key sk_xxx to generate an image...` ## API Key lookup logic 1. Check whether the user message contains an API Key (starting with sk_) 2. Check the configuration file ~/.jiekou/config.json 3. Check the JIEKOU_API_KEY environment variable 4. If none is available, return configuration guidanceThe excerpt above is translated into English for reporting purposes; the source file contains the equivalent instructions in Chinese.
Technical Analysis
The skill explicitly instructs users to place bearer credentials in conversational messages and gives such credentials the highest lookup priority. Chat input is not an appropriate secret-storage or secret-transfer mechanism because prompts may be retained in conversation history, telemetry, debugging traces, exported transcripts, or other platform logs. They may also be exposed to other tools or agents that can access session context.
A key found merely by matching an
sk_prefix may also be captured from quoted material or unrelated text. The documentation does not require explicit secret confirmation, redaction, bounded validation, or removal of the credential from subsequent context.Attack Path
- A user follows the documented direct-parameter method and submits a valid key in a chat message.
- The plaintext key becomes part of the session history and may enter platform logs or traces.
- A party with access to those records, such as another user of a shared transcript, an operator, a compromised integration, or an overly broad diagnostic system, retrieves the key.
- The party uses the bearer key directly against
https://api.jiekou.ai. - Requests are charged to the victim and remain possible until th ...[truncated 446 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove support for submitting API keys through chat messages and remove chat-message key scanning from both
SKILL.mdandagents/openclaw.yaml. - Accept credentials only through a platform-managed secret store or a dedicated masked credential input mechanism.
- If conversational submission cannot be eliminated immediately:
- Require explicit user confirmation before extracting a candidate secret.
- Never echo the key.
- Redact matching values from logs, traces, errors, and conversation exports.
- Validate the complete credential format rather than searching for any
sk_substring. - Clear the sensitive value from transient state immediately after constructing the authenticated request.
- Document key rotation and revocation procedures for users who previously submitted keys through chat.
- Add tests verifying that prompts containing
sk_values are neither treated as credentials nor retained in diagnostic output.
- Remove support for submitting API keys through chat messages and remove chat-message key scanning from both
