T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:12
- Finding
- Obsidian API Bearer Key Stored in Plaintext Workspace Documentation## Vulnerability Details **File Location**: `SKILL.md`, lines 12-24 **Vulnerability Type**: Plaintext storage of a privileged API credential **Risk Level**: High ### Vulnerable Code ```markdown 1. Check TOOLS.md for existing `OBSIDIAN_API_URL` and `OBSIDIAN_API_KEY` 2. If not found: - Get Windows host IP: `cat /etc/resolv.conf | grep nameserver | awk '{print $2}'` - Ask user for API Key - Save to TOOLS.md: ```markdown ### Obsidian REST API (WSL → Windows) **API 端点**: https://<detected-ip>:27124 **API Key**: <user-provided-key> ``` 3. Test connection with saved config ``` The credential is subsequently extracted directly from the plaintext file at `SKILL.md`, lines 36-39: ```bash # Get URL and KEY from TOOLS.md URL=$(grep 'API 端点' ~/.openclaw/workspace/TOOLS.md | awk -F': ' '{print $2}') KEY=$(grep 'API Key' ~/.openclaw/workspace/TOOLS.md | awk -F': ' '{print $2}') ``` ### Technical Analysis The Skill explicitly directs the agent to persist a user-provided bearer key in `~/.openclaw/workspace/TOOLS.md`. This is a general workspace Markdown file rather than a credential manager or access-controlled secret store. The key authorizes operations against the Obsidian Local REST API. According to the bundled API documentation, authenticated clients can read, create, overwrite, append to, partially modify, and delete vault files. They can also interact with the active file and invoke exposed Obsidian commands. Any process, agent, extension, backup service, synchronization mechanism, or user that can read the workspace file can recover the credential. Because it is a bearer token, possession is sufficient for authentication without an additional proof of identity. ### Attack Path 1. The user supplies an Obsidian Local REST API key. 2. The Skill writes the key into `~/.openclaw/workspace/TOOLS.md` as plaintext. 3. An attacker or untrusted local component ob ...[truncated 1130 chars]
- Remediation
- ## Remediation Suggestions 1. Do not store bearer keys in `TOOLS.md`, other workspace documentation, source files, or shell history. 2. Store the key in an operating-system credential manager or a dedicated secret-management facility. 3. If file-based storage is unavoidable, use a separate secret file outside the shared workspace, restrict it to the owning user with mode `0600`, and ensure that it is excluded from synchronization, version control, backups, and diagnostic bundles. 4. Load the key through a protected environment variable or secret-injection mechanism without printing it. 5. Redact Authorization headers and credential values from logs, tool output, and error reports. 6. Rotate any key that has already been written to a broadly accessible workspace file. 7. Use a dedicated key with the narrowest permissions supported by the plugin and establish a regular rotation procedure.
