T09 · Insecure Skill Coding Practices
- Location
SKILL.md:82- Finding
Shell Command Injection Through Unescaped User-Controlled Prompt Content
- Content
View full analysis
Project Key: User Objective: Execution Requirements: 1) Work only inside . 2) Complete the requested work. 3) After completion, return a short completion summary. ``` ```bash bash pty:true workdir: command:"claude --dangerously-skip-permissions ''" ``` ```bash bash pty:true workdir: command:"codex exec --dangerously-bypass-approvals-and-sandbox ''" ``` ```bash bash pty:true workdir: command:"GEMINI_SANDBOX=false gemini -p ''" ``` ### Technical Analysis The skill instructs OpenClaw to use the original user request as the execution objective and interpolate it into ``. That rendered prompt is then placed inside a single-quoted shell argument. No escaping, argument-array construction, or validation is prescribed before the user-controlled objective reaches the shell command. A single quote in the objective can terminate the intended prompt argument. Subsequent shell metacharacters can then introduce an additional command. The prompt template does not mitigate this issue: wrapping untrusted content in a larger template does not make it safe for shell interpolation. ### Attack Path 1. An attacker submits a PREQSTATION request containing a single quote followed by shell syntax. 2. The skill copies the complete request into the `objective` field. 3. The objective is inserted into ``. 4. The rendered prompt is embedded into the documented command as `''`. 5. The attacker-provided quote terminates the prompt argument. 6. The shell interprets the remaining injected text as syntax or an additional command. 7. The injected command execut ...[truncated 980 chars]- Remediation
View remediation
