T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:24
- Finding
- Plaintext MongoDB credentials are recommended for persistent project storage<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 24-31 **Vulnerability Type**: Plaintext sensitive-data storage **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown **Recommendation**: Save connection info to project's `TOOLS.md` for future reference: ```markdown ### MongoDB - mongo_conn_str: mongodb://user:pass@host:port/?options - mongo_namespace: (optional - only if K8s service name) ``` ``` ### Technical Analysis The Skill recommends saving a complete MongoDB connection URI, including the username and password, in the project's `TOOLS.md` file. This converts a transient secret into a persistent plaintext credential. Project files can be read by other tools and Agents, included in backups, copied into diagnostic archives, indexed by development tooling, or accidentally committed to version control. The instructions do not prescribe restrictive file permissions, repository exclusions, credential rotation, or a secret-management mechanism. ### Attack Path 1. A user provides a MongoDB URI containing valid credentials. 2. Following the Skill's recommendation, the user or Agent writes the URI to `TOOLS.md`. 3. The project directory is shared, backed up, indexed, or committed to a repository. 4. Another local user, tool, Agent, or repository reader accesses `TOOLS.md`. 5. The exposed credentials are reused to authenticate to MongoDB. 6. The attacker gains whatever database access is granted to the compromised account. ### Impact Assessment An attacker may obtain reusable MongoDB credentials. The resulting privileges depend on the database account's roles and could include reading sensitive records, enumerating databases and collections, modifying or deleting data, or performing administrative operations if a highly privileged account is used. The exposure can persist beyond the Skill invocation because the credential remains in the project file until explicitly removed and rotated. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove the recommendation to store complete connection URIs in `TOOLS.md`. - Retrieve credentials from an operating-system secret store, a dedicated secrets manager, or a protected environment variable. - If file-based secret input is unavoidable, use a dedicated file outside the project tree with owner-only permissions such as mode `0600`. - Ensure all local secret files are excluded from version control and backup or diagnostic bundles. - Store non-sensitive connection metadata separately from passwords. - Document credential rotation procedures for any URI that may already have been persisted. - Use a dedicated least-privilege MongoDB account with only the permissions required for troubleshooting. ]]>
