T09 · Insecure Skill Coding Practices
- Location
SKILL.md:47- Finding
Plaintext API Key Stored and Sourced Without Permission Hardening
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 47–57
Vulnerability Type: Plaintext credential storage and unsafe shell sourcing
Risk Level: MediumVulnerable Code
bash echo 'CLAWTUNES_API_KEY=ct_YOUR_KEY_HERE' > ~/.openclaw/workspace/.env.clawtunesbash source ~/.openclaw/workspace/.env.clawtunes curl -s -X POST https://clawtunes.com/api/tunes \ -H "Content-Type: application/json" \ -H "X-Agent-Key: $CLAWTUNES_API_KEY" \ -d '{ ... }'Technical Analysis
The Skill instructs users to store the ClawTunes API key as plaintext at a predictable path. It does not set a restrictive
umask, apply mode600, verify ownership, or recommend a dedicated secret manager. The resulting permissions depend on the existing environment and may allow other local users or processes to read the credential.The instructions subsequently use
sourceto load the file. Unlike parsing a data-only configuration file,sourceexecutes its contents as shell code in the current shell. If another local process can modify the file, it can replace or supplement the variable assignment with arbitrary shell commands.Sending the key in the
X-Agent-Keyheader tohttps://clawtunes.comis necessary for the declared authenticated functionality and is not, by itself, evidence of malicious exfiltration. The weakness is the local storage and loading procedure.Attack Path
- A user follows the documented command and creates
.env.clawtuneswith permissions inherited from the currentumask. - A local user or process with workspace access reads the file and obtains the plaintext API key.
- The attacker submits authenticated requests to ClawTunes using the stolen
X-Agent-Key, impersonating the agent. - Alternatively, if write access is available, the attacker inserts shell commands into
.env.clawtunes. - When the victim runs
source ~/.openclaw/workspace/.env.clawtunes, the injec ...[truncated 925 chars]
- A user follows the documented command and creates
- Remediation
View remediation
Remediation Suggestions
-
Prefer an OpenClaw or operating-system secret manager instead of a workspace plaintext file.
-
If a file is unavoidable, create it with restrictive permissions from the outset:
bash install -m 600 /dev/null "$HOME/.openclaw/workspace/.env.clawtunes" printf '%s\n' 'CLAWTUNES_API_KEY=ct_YOUR_KEY_HERE' \ > "$HOME/.openclaw/workspace/.env.clawtunes" -
Set
umask 077before creating any credential file and verify that the file is owned by the current user, is not a symbolic link, and has no group or world permissions. -
Do not use
sourcefor a credential data file. Parse a narrowly defined assignment or inject the secret directly through a protected runtime environment. -
Keep the credential outside shared or version-controlled workspace directories and add the filename to applicable ignore rules.
-
Rotate the API key immediately if unintended disclosure is suspected. Because the document indicates that keys cannot be recovered, provide a documented revocation or replacement procedure where supported.
-
Avoid printing registration responses containing
apiKeyorclaimUrlinto persistent logs.
-
