T09 · Insecure Skill Coding Practices
Warning
- Location
- skill.md:75
- Finding
- Plaintext API Credential Storage Without Access-Control Requirements<![CDATA[ ## Vulnerability Details **File Location**: `skill.md:75-84` **Vulnerability Type**: Plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code ```markdown **Recommended:** Save your credentials to `~/.config/moltoverflow/credentials.json`: ```json { "api_key": "moltoverflow_xxx...", "agent_name": "YourMoltyName" } ``` This way you can always find your key later. You can also save it to your memory, environment variables (`MOLTOVERFLOW_API_KEY`), or wherever you store secrets. ``` ### Technical Analysis The Skill recommends storing a bearer API key in a plaintext JSON file but does not require restrictive permissions for either the configuration directory or the credential file. Depending on the host's default umask, the resulting file may be readable by other local users, processes, backup systems, synchronization tools, or unrelated agents. The alternative recommendation to save the key in agent memory is also unsafe unless the memory implementation is explicitly private, encrypted, access-controlled, and excluded from later prompts or public output. Environment variables may likewise be exposed through process inspection, debugging output, crash reports, or inherited child processes. Persisting this credential is reasonably related to authenticated MoltOverflow operations, so the access itself does not exceed the Skill's functional needs. The weakness is that the storage instructions do not enforce least exposure for a reusable authentication secret. ### Attack Path 1. The agent registers with MoltOverflow and receives a reusable bearer API key. 2. The user or agent follows the Skill instructions and writes the key to `~/.config/moltoverflow/credentials.json`. 3. The file is created under permissive default permissions, copied into an insecure backup, or placed in shared agent memory. 4. Another local account, process, plugin, agent, or memory consumer retrieves the key. 5. The attacker sends requests with `Authoriz ...[truncated 717 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prefer an operating-system credential manager or a narrowly scoped secret provider instead of a plaintext file. 2. If file storage must be supported, create the directory and file with restrictive permissions: ```bash install -d -m 700 "$HOME/.config/moltoverflow" umask 077 printf '%s\n' '{"api_key":"...","agent_name":"..."}' \ > "$HOME/.config/moltoverflow/credentials.json" chmod 600 "$HOME/.config/moltoverflow/credentials.json" ``` 3. Write the credential atomically and avoid exposing it in command history, logs, process arguments, or temporary files. 4. Remove the recommendation to place the API key in general agent memory unless the storage system provides documented encryption and strict isolation. 5. Document credential revocation and rotation procedures for suspected disclosure. 6. Redact the API key from diagnostics, public questions, answers, prompts, and error reports. 7. If supported by the service, use scoped and expiring tokens rather than a long-lived unrestricted bearer key. ]]>
