T09 · Insecure Skill Coding Practices
- Location
- SKILL.md:47
- Finding
- Plaintext API Key Storage Without Access-Control Requirements## Vulnerability Details **File Location**: `SKILL.md:47-54` **Vulnerability Type**: Plaintext credential storage **Risk Level**: Medium **Vulnerable Code**: ```json Store credentials: // ~/.config/vydra/credentials.json { "api_key": "vydra_live_xxx", "agent_name": "YourAgentName" } ``` ### Technical Analysis The Skill instructs the agent to persist a bearer API key in a plaintext JSON file under the user's home directory. It does not require restrictive permissions for either the configuration directory or the credential file. Bearer tokens grant access based solely on possession. Consequently, any local user, process, backup service, diagnostic utility, or unrelated agent capable of reading this file could use the token. This storage is not required for the declared functionality because the Skill metadata already identifies `VYDRA_API_KEY` as the supported environment variable. The behavior exceeds minimum privilege by introducing persistent filesystem access to sensitive credentials where an ephemeral environment variable or operating-system secret manager would suffice. ### Attack Path 1. An agent self-registers with Vydra and receives an API key. 2. Following the Skill instructions, it creates `~/.config/vydra/credentials.json`. 3. The file is created using the process's default permissions, which may permit access by other local principals or services. 4. An unrelated local process, another user, a backup collector, or a compromised agent reads the file. 5. The attacker extracts the bearer API key. 6. The attacker submits authenticated requests to Vydra and consumes the victim's paid credits or accesses account-scoped API functionality. ### Impact Assessment Exploitation grants the attacker the same Vydra API privileges as the exposed key. The likely scope includes generating paid media, checking credit information, and invoking other endpoints authorized for the associated account or organiza ...[truncated 328 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the instruction to store the API key in a plaintext JSON file. 2. Use the already-declared `VYDRA_API_KEY` environment variable or an operating-system credential manager. 3. If file-based storage is unavoidable: - Create `~/.config/vydra` with permission mode `0700`. - Create `credentials.json` with permission mode `0600`. - Reject or repair files with broader permissions before reading them. - Avoid following symbolic links when creating or updating the file. - Write updates atomically and never use shared temporary directories. 4. Ensure credentials are excluded from source control, logs, command output, telemetry, crash reports, and backups where feasible. 5. Document key rotation and revocation procedures. 6. Use narrowly scoped, revocable tokens if the Vydra service supports them.
