T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:216
- Finding
- Wallet Bearer Credentials Are Persisted Without Mandatory Filesystem Protections<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 40 and 216-217 **Vulnerability Type**: Plaintext sensitive credential storage **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`. ``` ```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 API key is a bearer credential authorizing financially consequential wallet operations. The Skill directs the agent to persist this credential in a JSON file but does not require restrictive directory or file permissions, encryption at rest, use of an operating-system credential manager, log redaction, or protection against source-control inclusion. The fallback location under the current working directory is especially unsafe because it may be inside a repository, shared workspace, synchronized directory, build context, or backup set. A plaintext key could consequently be exposed through an accidental commit, artifact upload, permissive file mode, workspace sharing, or access by another local process. Searching the dedicated `agentwallet` directory is reasonably connected to credential retrieval and is not evidence of indiscriminate credential harvesting. The security ...[truncated 1165 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Store the API key in an operating-system credential manager or platform-provided secret store rather than a project directory. 2. If file storage is unavoidable, require the credential directory to use mode `0700` and each credential file to use mode `0600`. 3. Prohibit credential storage under the current working directory or any source-controlled project. 4. Add `agentwallet/` and equivalent credential paths to source-control ignore rules. 5. Use atomic file creation with restrictive permissions rather than creating a permissive file and changing its mode afterward. 6. Never print the bearer key in logs, command output, error messages, telemetry, or conversational responses. 7. Document key revocation and rotation procedures and rotate a key immediately after suspected disclosure. 8. Where supported, issue narrowly scoped and short-lived credentials instead of long-lived bearer keys. ]]>
