T09 · Insecure Skill Coding Practices
- Location
SKILL.md:39- Finding
Plaintext Collection and Persistence of Authentication Credentials
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 39–51
Vulnerability Type: Plaintext sensitive-data handling
Risk Level: HighComplete Vulnerable Snippet:
markdown 2. **Check Storage**: Look for the credentials in the designated local directory based on the detected platform: - If Claude Code: check `~/.claude/skills-state/<tool-name>.json` - If Codex / Other: check `~/.ai-skills-state/<tool-name>.json` 3. **Prompt User (If Missing)**: - If the required credentials (e.g., API keys, tokens) are not found in the storage, **STOP** the tool execution. - Ask the user politely for the required information via a chat message. - *Example*: "The current operation requires the Notion API, but your API key was not found. Could you please provide it? I will save it locally in `~/.claude/skills-state/notion-skill.json` (or the appropriate path) for future use." 4. **Save State**: - Once the user provides the information in the chat, use the `Write` tool to save it into the JSON file resolved in Step 1. - For Claude Code, write to `~/.claude/skills-state/<tool-name>.json`. - For Codex / Other CLI, write to `~/.ai-skills-state/<tool-name>.json`. - Ensure the content is stored as valid JSON. - Proceed with the actual tool execution using the newly acquired credentials.Technical Analysis
The skill directs an AI agent to solicit API keys and tokens through chat and persist them in ordinary JSON files under the user's home directory. It does not require encryption, integration with an operating-system credential vault, restrictive file permissions, atomic file creation, log redaction, retention limits, or credential deletion and rotation procedures.
Consequently, sensitive values may remain exposed in both conversation history and plaintext filesystem state. Depending on the host configuration, chat transcripts, backups, synchronization software, diagnostic bundl ...[truncated 1532 chars]
- Remediation
View remediation
Remediation Suggestions
- Store credentials in an operating-system keychain or dedicated secret manager rather than plaintext JSON.
- Avoid requesting secrets through persistent chat. Use a masked terminal prompt, secure credential-entry interface, or provider authorization flow where available.
- Require explicit user consent before storing any credential and disclose its destination, retention period, and deletion procedure.
- If file-based storage is unavoidable, create the directory and files with owner-only permissions, such as
0700for directories and0600for files. - Create and replace credential files atomically to avoid insecure intermediate files and race conditions.
- Encrypt secrets at rest using keys that are not stored beside the encrypted data.
- Prevent secret values from appearing in tool output, logs, error messages, telemetry, and diagnostic bundles.
- Define credential expiration, deletion, revocation, and rotation workflows.
- Restrict each token to the minimum scopes required by the target tool.
- Validate and normalize the tool-derived filename to prevent traversal or unintended file writes.
