T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:40
- Finding
- Wallet Bearer Tokens Are Persisted Without Mandatory Storage Protections<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:40-44` and `SKILL.md:216-217` **Vulnerability Type**: Plaintext storage of financially sensitive bearer credentials **Risk Level**: High ### Vulnerable Code ```markdown All API requests require a Bearer token (the API key returned when creating a wallet). If you're an openclaw instance, store and retrieve it from `~/.openclaw/credentials/agentwallet/<API_KEY_ID>.json`. Otherwise, you can store it in your current working directory at `agentwallet/<API_KEY_ID>.json`. \`\`\` Authorization: Bearer <API_KEY> \`\`\` ``` The storage and lookup requirements are repeated later: ```markdown - Always store the API key from wallet creation. If you're an openclaw instance, store it in `~/.openclaw/credentials/agentwallet/<API_KEY_ID>.json`. Otherwise, you can store it in your current working directory at `agentwallet/<API_KEY_ID>.json`. - Always search for the API keys in the credentials folder before using the API. If you're an openclaw instance, search for the API key in `~/.openclaw/credentials/agentwallet/<API_KEY_ID>.json`. Otherwise, you can search for the API key in your current working directory at `agentwallet/<API_KEY_ID>.json`. ``` ### Technical Analysis The Skill requires persistent storage of a bearer token that authorizes financially sensitive wallet operations. However, it does not require encryption, an operating-system secret manager, restrictive directory and file permissions, repository exclusions, or credential redaction. The fallback location under the current working directory is particularly unsafe. Such files may be committed to source control, included in build artifacts or backups, exposed to other workspace users, or read by unrelated tools operating in the same project directory. Searching the dedicated credential directory is functionally related to the Skill and does not, by itself, exceed the minimum privilege required to retrieve this Skill's own token. The risk arises fr ...[truncated 1492 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store API keys in an operating-system credential manager or a dedicated secrets service rather than ordinary JSON files. 2. Remove the current-working-directory fallback because project folders are commonly synchronized, archived, or committed. 3. If filesystem storage is unavoidable: - Create the credential directory with mode `0700`. - Create credential files atomically with mode `0600`. - Reject symlinks and verify file ownership before reading. - Keep credentials outside repositories and shared workspaces. 4. Add the credential path to applicable source-control, backup, and artifact exclusion rules. 5. Never place bearer tokens in command output, logs, error reports, prompts, or shell history. 6. Provide token revocation and rotation procedures, including immediate rotation following suspected disclosure. 7. Store only the credential selected for the active wallet rather than broadly enumerating unrelated credential files. ]]>
