T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:58
- Finding
- Plaintext API Credential Storage Without Restrictive File Permissions## Vulnerability Details **File Location**: `SKILL.md`, lines 58-66 **Vulnerability Type**: Plaintext sensitive credential storage with insufficient access-control guidance **Risk Level**: Medium **Vulnerable Code Snippet**: ```markdown **⚠️ Save your `api_key` immediately!** You need it for all requests. **Recommended:** Save your credentials to `~/.config/clawdtm/credentials.json`: ```json { "api_key": "clawdtm_sk_xxx", "agent_name": "YourAgentName" } ``` ``` ### Technical Analysis The Skill recommends persistently storing a bearer API key in a plaintext JSON file. It does not require restrictive permissions for either the `~/.config/clawdtm` directory or the credential file, nor does it recommend using an operating-system credential store. The recommendation is functionally related to the Skill because authenticated ClawdTM operations require the API key. Therefore, storing this specific service credential does not exceed the Skill's declared functional scope by itself. However, the documented storage method is not sufficiently hardened. Depending on the user's umask and the mechanism used to create the file, the credential could be readable by other local users or exposed to unrelated processes, backup systems, diagnostic archives, or accidental source-control commits. The API key authorizes operations performed as the registered agent, including creating, updating, and deleting reviews. The audited documentation does not indicate that the key grants operating-system access or access to unrelated accounts. ### Attack Path 1. A user or agent registers with ClawdTM and receives a bearer API key. 2. Following the Skill's recommendation, it writes the key to `~/.config/clawdtm/credentials.json`. 3. The file is created with permissions that allow an unauthorized local account or compromised process to read it. 4. The attacker extracts the `clawdtm_sk_...` value. 5. The attacker supplies the stolen valu ...[truncated 970 chars]
- Remediation
- ## Remediation Suggestions 1. Prefer an operating-system credential manager, such as macOS Keychain, Windows Credential Manager, or a Linux Secret Service implementation, instead of a plaintext JSON file. 2. If file-based storage is required, explicitly create the directory and file with owner-only permissions: ```bash install -d -m 700 "$HOME/.config/clawdtm" umask 077 printf '%s\n' '{"api_key":"clawdtm_sk_xxx","agent_name":"YourAgentName"}' \ > "$HOME/.config/clawdtm/credentials.json" chmod 600 "$HOME/.config/clawdtm/credentials.json" ``` 3. Verify ownership and permissions before reading the credential file, and reject files writable or readable by unauthorized users. 4. Warn users not to commit the file to source control, include it in support bundles, paste it into logs, or expose the `Authorization` header in debugging output. 5. Document a key revocation and rotation process for suspected disclosure. 6. Use narrowly scoped and revocable tokens where supported by the service, limiting the credential to only the API operations required by the Skill.
