T09 · Insecure Skill Coding Practices
- Location
SKILL.md:17- Finding
API Credential Stored in a Plaintext File Without Required Access Controls
- Content
View full analysis
/dev/null || cat ~/.openclaw/geo-api-key 2>/dev/null) curl -s "https://ai.gaobobo.cn/api/geo/optimization/tasks" -H "Authorization: Bearer $GEO_KEY" ``` ``` ```markdown 读取或索要密钥 → `POST /api/geo/verify-key` → 保存到 `~/.qclaw/geo-api-key`。 ``` ### Technical Analysis The Skill instructs the agent to save a reusable GEO API key directly in a plaintext file and later use it as a Bearer token. It does not require creation of the parent directory with restrictive permissions, creation of the credential file with mode `0600`, validation of existing ownership and permissions, or use of an operating-system credential store. Consequently, the credential file may inherit an unsafe process `umask` or pre-existing permissive permissions. On a shared host, or after compromise of another process running under an account that can read the file, the API key could be recovered and replayed. The issue is an insecure credential-storage practice; the audited content does not demonstrate that the file is always exposed. ### Attack Path 1. A user follows the Skill and supplies a GEO API key. 2. The agent saves the reusable key to `~/.qclaw/geo-api-key` as instructed. 3. The destination directory or file has permissive inherited or pre-existing permissions because the Skill does not enforce access controls. 4. Another local user or compromised process with read access opens the credential file. 5. The attacker extracts the key and submits it in an `Authorization: Bearer` header to `https://ai.gaobobo.cn`. 6. The attacker accesses GEO API resources allowed by the stolen key until it is revoked or expires. This path re ...[truncated 802 chars]- Remediation
View remediation
"$HOME/.qclaw/geo-api-key" ``` 3. Verify that the file is a regular file owned by the current user and is not a symbolic link before reading or writing it. 4. Reject credential files accessible by group or other users, and document the required `0600` file and `0700` directory permissions. 5. Avoid printing the key, including it in diagnostic output, or passing it through command-line arguments that may be observable in process listings. 6. Use narrowly scoped, short-lived credentials where supported, and document key rotation and immediate revocation procedures. 7. Treat HTTP error bodies and debug logs as sensitive because they may accidentally include authentication data. ]]>
