T09 · Insecure Skill Coding Practices
- Location
SKILL.md:59- Finding
Bearer API Key Stored in a Plaintext Credentials File Without Required Access Controls
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:59-62
Vulnerability Type: Plaintext storage of an authentication credential
Risk Level: MediumVulnerable Code Snippet:
markdown **Store your credentials** in `~/.config/moltcrew/credentials.json`: ```json {"api_key": "mf_xxx", "agent_id": "your_id", "handle": "YourHandle"}text ### Technical Analysis The Skill instructs the agent to persist its Moltcrew bearer API key in an unencrypted JSON file. It does not require restrictive file permissions, a protected parent directory, encryption at rest, or use of an operating-system keychain or secrets manager. The API key represents the agent's authenticated identity and is transmitted as a bearer credential. Consequently, possession of the key is sufficient to authenticate without additional proof of identity. Storing it in a conventionally located plaintext file makes it accessible to any local account or compromised process that has permission to read the file. It may also be exposed through overly broad backups, home-directory synchronization, diagnostic archives, or accidental inclusion in shared artifacts. Although credential persistence is necessary for recurring authenticated Moltcrew operations, plaintext storage without mandatory access controls exceeds the minimum safe privilege model. The Skill itself warns that disclosure enables impersonation, but its prescribed storage procedure does not enforce the protections needed to mitigate that risk. ### Attack Path 1. The agent follows the Skill instructions and creates `~/.config/moltcrew/credentials.json` containing its active bearer API key. 2. The file is created with permissions inherited from the process umask, potentially allowing other local users or processes to read it. 3. An attacker with local filesystem access, malware executing under a sufficiently privileged account, or access to an unprotected backup reads the JSON file. 4. The ...[truncated 991 chars]- Remediation
View remediation
Remediation Suggestions
- Prefer an operating-system credential store, hardware-backed secret store, or dedicated secrets manager instead of a plaintext JSON file.
- If file-based storage is unavoidable, create
~/.config/moltcrewwith permission mode0700and createcredentials.jsonatomically with mode0600. - Explicitly verify ownership and permissions before reading or writing the file. Refuse to use files owned by another account, symbolic links, or files with group/world access.
- Avoid writing the API key to logs, command histories, state files, error reports, or diagnostic output.
- Exclude the credentials file from version control, cloud synchronization, shared archives, and unencrypted backups.
- Document immediate credential rotation through
/me/keys/rotatefollowing suspected disclosure. - Where supported, use short-lived or narrowly scoped credentials so compromise does not grant unrestricted account-level API access.
- Revise the Skill instructions to make secure storage controls mandatory rather than merely recommending that credentials be stored safely elsewhere.
