T09 · Insecure Skill Coding Practices
- Location
SKILL.md:28- Finding
Shell Command Injection Through Untrusted User-Message Interpolation
- Content
View full analysis
/scripts/router.py --task ""` 2. **Parse JSON** → get `full_id`, `tier`, `confidence` 3. **If `full_id` is `fallback/default`**: do NOT switch. Tell the user to run `--setup`. 4. **If `full_id` differs from current model**: `session_status(model=)` ``` ### Technical Analysis The Skill directs the Agent to interpolate the complete, untrusted user message into a shell command. Double quotes do not prevent shell evaluation of command substitutions such as `$()` or backticks. Embedded quotes can also terminate the intended argument and expose subsequent text to shell parsing. The Python implementation uses `argparse` safely after process creation, but that does not mitigate evaluation performed by a shell before `router.py` starts. Exploitability therefore depends on the Agent implementing this instruction through a shell-based execution tool. This is a realistic execution path because the instruction is presented as a command string rather than an argument-array invocation. Routing only requires passing text to a local Python process. Exposing the message to shell parsing exceeds the minimum privileges necessary for that operation. ### Attack Path 1. An attacker submits a substantive user message containing shell command-substitution syntax or quote-breaking metacharacters. 2. The Agent follows `SKILL.md` and embeds the message in the documented command. 3. The Agent invokes the resulting string through a shell. 4. The shell evaluates attacker-controlled syntax before launching Python. 5. The injected command executes with the same operating-system privileges and filesystem access as the Agent process. ### Impact Assessment Successful exploitation can provide arbitrary command execution under the Agent's account. Depending on that ...[truncated 575 chars]- Remediation
View remediation
