T09 · Insecure Skill Coding Practices
- Location
SKILL.md:52- Finding
Unsafe Plaintext API Key Persistence and Shell Sourcing
- Content
View full analysis
~/.openclaw/workspace/.env source ~/.openclaw/workspace/.env ``` ``` The troubleshooting section also recommends broader credential storage: ```text - If using systemd/systemctl, set the key in the service file or `/etc/environment` ``` ### Technical Analysis The documented setup persists the Exa API key in predictable plaintext locations without establishing restrictive permissions. The redirection operator also unconditionally truncates the existing `.env` file and follows symbolic links. Consequently, following the instructions can destroy existing workspace configuration or overwrite another user-writable file targeted through a malicious symlink. Using `source` interprets the entire `.env` file as shell code rather than reading only the expected `EXA_API_KEY` value. If another process or local user can modify or replace this file before it is sourced, arbitrary commands in the file execute with the privileges of the user performing setup. The recommendation to place the key in `/etc/environment` or a service file can expose it more broadly than required. The Skill only needs access to one environment variable while executing, so system-wide credential persistence exceeds the minimum privilege and exposure necessary for its declared web-search function. ### Attack Path 1. A local attacker obtains write access to the OpenClaw workspace or can replace `~/.openclaw/workspace/.env`. 2. The attacker creates a malicious `.env` file containing the ...[truncated 1458 chars]- Remediation
View remediation
