T09 · Insecure Skill Coding Practices
- Location
scripts/send-voice-memo.sh:27- Finding
Shared credential file is executed as arbitrary shell code
- Content
View full analysis
Vulnerability Details
File Location:
scripts/send-voice-memo.sh, lines 27-32
Vulnerability Type: Unsafe execution of configuration data
Risk Level: HighVulnerable Code
bash # Load environment variables if [[ -f ~/.openclaw/.env ]]; then source ~/.openclaw/.env else echo "❌ Error: ~/.openclaw/.env not found" exit 1 fiTechnical Analysis
The Bash
sourcecommand executes the target file in the current shell; it does not limit processing to environment-variable assignments. Consequently, command substitutions, function declarations, shell redirections, and arbitrary commands placed in~/.openclaw/.envare executed with the permissions of the user running the Skill.The declared functionality only requires selected configuration values, primarily
ELEVENLABS_API_KEYandBLUEBUBBLES_PASSWORD. Executing the entire shared configuration file exceeds the minimum access necessary for retrieving those values. It also imports unrelated variables and credentials from the file into the Skill process.This issue requires an attacker, compromised component, or untrusted configuration-management process to gain write access to
~/.openclaw/.env. It does not independently grant elevated operating-system privileges beyond those already held by the Skill process.Attack Path
- An attacker or compromised local component obtains permission to modify
~/.openclaw/.env. - The attacker adds a shell payload, for example:
bash ELEVENLABS_API_KEY="$(malicious-command)" - The user or Agent invokes
scripts/send-voice-memo.sh. - The script executes
source ~/.openclaw/.envbefore validating any input or credentials. - The injected command runs with the permissions and filesystem access of the user operating OpenClaw.
Impact Assessment
Successful exploitation permits arbitrary command execution in the OpenClaw user's security context. The attack ...[truncated 312 chars]
- An attacker or compromised local component obtains permission to modify
- Remediation
View remediation
Remediation Suggestions
- Do not use
sourceto parse a credential file. - Prefer passing only the required variables through the process environment or a dedicated secret manager.
- If dotenv loading is necessary, use a parser that accepts only literal
KEY=VALUErecords and never evaluates shell syntax. - Allowlist the exact supported keys:
ELEVENLABS_API_KEYBLUEBUBBLES_PASSWORDELEVENLABS_VOICE_IDELEVENLABS_MODEL_IDBLUEBUBBLES_URLIMESSAGE_RECIPIENTVOICE_MEMO_OUTPUT_DIR
- Reject command substitutions, shell metacharacters, function definitions, redirections, and malformed key names.
- Verify that the credential file is owned by the expected user and is not group- or world-writable. Recommend permissions of
0600. - Keep unrelated secrets in separate credential stores so this Skill cannot unnecessarily inherit them.
- Do not use
