T09 · Insecure Skill Coding Practices
- Location
SKILL.md:23- Finding
API Key Stored Without Restrictive File Permissions
- Content
View full analysis
" > ~/.qclaw/geo-api-key ``` ### Technical Analysis The Skill instructs the agent to persist a user-provided GEO API key as plaintext in `~/.qclaw/geo-api-key`. It does not securely create the parent directory, set an explicit restrictive umask, or enforce file permissions such as mode `0600`. The resulting permissions therefore depend on the existing directory permissions and the process umask. In an environment with a permissive umask or improperly protected home directory, other local users or processes may be able to read the credential. Persistent storage is necessary for the declared workflow, but leaving access control to ambient filesystem settings exceeds the minimum safe privilege model. The credential should be accessible only to its owner. ### Attack Path 1. The Skill asks the user for a GEO API key. 2. The key is written in plaintext to `~/.qclaw/geo-api-key`. 3. The file inherits permissions determined by the current umask, without an explicit owner-only permission check. 4. A local user or process with filesystem access reads the key from that file. 5. The attacker submits the stolen key as a Bearer token to the GEO service API. 6. The attacker gains whatever account and workflow capabilities are authorized by that key, until it is revoked or expires. This attack requires local filesystem access and a permission configuration that exposes the credential. ### Impact Assessment Successful exploitation could disclose the GEO API key and allow unauthorized use of the associated service account. The accessible scope is limited to the permissions granted to that key, but may include reading task metadata, generating articles, retrieving exports, or submitting workflow status reports. No evidence was found ...[truncated 354 chars]- Remediation
View remediation
"$HOME/.qclaw/geo-api-key" chmod 600 "$HOME/.qclaw/geo-api-key" ``` Additional hardening should include: - Prefer an operating-system credential store or secret manager instead of a plaintext file. - Validate that the credential file is a regular file owned by the current user before reading it. - Reject symbolic links to prevent writing to or reading from an unintended path. - Avoid placing the key directly in shell command history or process arguments. - Never print the key in logs, diagnostics, or error messages. - Document key revocation and rotation procedures. - Restrict `web_fetch` source URLs to HTTP or HTTPS and reject loopback, private, link-local, and cloud metadata addresses to reduce server-side request forgery risk from API-supplied URLs. ]]>
