T09 · Insecure Skill Coding Practices
- Location
SKILL.md:16- Finding
Shell Command Injection Through Unescaped Template Placeholders
- Content
View full analysis
&& claude --bare -p "" --max-turns 10'` | | Long streaming task | `bash -lc 'cd && claude --bare -p "" --output-format stream-json --verbose --include-partial-messages --max-turns 30'` | | Full permissions | `bash -lc 'cd && claude --bare -p "" --dangerously-skip-permissions --output-format stream-json --verbose --include-partial-messages --max-turns 30'` | | Read-only analysis | `bash -lc 'cd && claude --bare -p "" --permission-mode plan --allowedTools "Read,Glob,Grep,LSP" --max-turns 10'` | ``` ```json { "command": "bash -lc 'cd && claude --bare -p \"\" --max-turns 10'", "host": "node", "node": "", "background": true, "timeout": 600 } ``` ### Technical Analysis The documented templates insert `` and `` directly into a command interpreted by `bash -lc`. The project path is not quoted, while the task is placed inside nested shell and JSON quotation contexts without a defined escaping mechanism. If either value originates from an untrusted or insufficiently validated source, shell metacharacters, quote characters, command substitutions, or separators can escape the intended argument context. The shell then interprets the injected content as additional commands on the remote Node. Nested quoting does not provide a security boundary. In particular, inserting a double quote into the task can terminate the intended prompt argument, while an unquoted project value can directly introduce shell operators. ### Attack Path 1. An attacker influences the project path or delegated task supplied to the documented command template. 2. The attacker includes shell syntax that escapes the intended `cd` p ...[truncated 1043 chars]- Remediation
View remediation
