T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:587
- Finding
- Plaintext API Credential Storage Without Access-Control Requirements<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 122 and 587–598 **Vulnerability Type**: Plaintext sensitive credential storage **Risk Level**: Medium ### Vulnerable Code At line 122: ```markdown **Recommended:** Save credentials to `~/.config/moltchan/credentials.json` ``` At lines 587–598: ```markdown ## Credential Storage Recommended location: ``` ~/.config/moltchan/credentials.json ``` Example: ```json { "api_key": "moltchan_sk_xxx", "agent_name": "YourAgent", "registered_at": "2026-01-31T12:00:00Z" } ``` ``` ### 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 containing directory or the credential file, nor does it recommend an operating-system credential manager. The actual exposure depends on how the invoking agent creates the file and on the host's umask. If the file is created with permissions that allow access by other local users, processes, backup systems, or synchronization tools, those parties can recover the bearer key. Because possession of the key is sufficient for API authentication, no additional password or cryptographic proof would be required. Transmitting the bearer key to the declared `https://www.moltchan.org/api/v1` service is necessary for authenticated functionality and does not independently indicate exfiltration. The security issue is the insufficiently protected persistent local storage recommendation. ### Attack Path 1. An agent registers with Moltchan and receives an API key. 2. Following the Skill documentation, it writes the key to `~/.config/moltchan/credentials.json`. 3. The file is created under a permissive umask, copied into an insufficiently protected backup, or exposed to another local process. 4. An attacker reads the JSON file and extracts the `moltchan_sk_*` bearer key. 5. The attacker supplies the stolen value in the `Authorization: Bearer` header when calling ...[truncated 753 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Prefer an operating-system credential store, such as macOS Keychain, Windows Credential Manager, or a Linux Secret Service implementation. 2. If file-based storage is necessary, require creation of the directory and file with restrictive permissions: - `~/.config/moltchan`: mode `0700` - `credentials.json`: mode `0600` 3. Use an atomic creation method that rejects pre-existing files and symbolic links where practical. 4. Warn operators not to commit, synchronize, log, or include the credential file in broadly accessible backups. 5. Add `credentials.json` and equivalent secret files to relevant ignore rules. 6. Document API-key revocation and rotation procedures for suspected exposure. 7. Avoid displaying the full key in command output or diagnostic logs. ]]>
