T09 · Insecure Skill Coding Practices
- Location
SKILL.md:34- Finding
Plaintext API Key Storage in a Predictable Workspace File
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 34-49
Vulnerability Type: Plaintext sensitive credential storage
Risk Level: MediumVulnerable Code Snippet
markdown - If the file does not exist, or if it exists but does not contain a line that starts with `api_key:`, **stop here** and tell your owner the following: > To connect me to Clawtales you need to register at > **https://clawtales.com/register**. After registering, your API key will be > displayed once on the confirmation screen — copy it immediately and add it > to a file called `clawtales.md` in my workspace with this exact line: > > ``` > api_key: ct_xxxx > ``` > > Replace `ct_xxxx` with your actual key. Once that file is in place, run me > again and I will pick up from here. - If the file exists and contains a valid `api_key:` line, read the key and keep it in memory for the rest of this session. Do not log or echo it.Technical Analysis
The skill directs the user to persist a bearer API key as plaintext in a predictably named workspace file,
clawtales.md. Although it instructs the agent not to log or echo the key, it does not require restrictive file permissions, repository exclusion, encryption, an operating-system credential store, or another dedicated secret-management mechanism.Workspace files may be accessible to other agents, local processes, collaborators, source-control tooling, backups, indexing systems, or artifact collectors. Because the credential is a bearer token, possession may be sufficient to authenticate as the user. The later instructions use it in the
Authorization: Bearer <your api_key>header for write operations.Attack Path
- A user follows the skill instructions and saves a valid API key in
clawtales.md. - The file remains in plaintext with permissions and external handling determined by the surrounding workspace.
- An attacker, ...[truncated 1134 chars]
- A user follows the skill instructions and saves a valid API key in
- Remediation
View remediation
Remediation Suggestions
- Store the API key in a dedicated secret manager, operating-system credential store, or environment-backed secret injection facility rather than a general workspace document.
- Update the skill to read the credential through the platform's supported secret interface without writing it into project content.
- If file-based storage is unavoidable, use a separate secrets file outside the shared workspace and require owner-only permissions, such as mode
0600on compatible systems. - Explicitly exclude all credential files from source control, synchronization, artifact packaging, logs, backups, and indexing where possible.
- Validate that the expected file is a regular file owned by the current user and reject symbolic links or unexpectedly permissive files before reading it.
- Keep the key out of generated content, error messages, command-line arguments, and diagnostic output.
- Provide key revocation and rotation guidance for suspected exposure, and scope tokens to the minimum API privileges supported by the service.
