T09 · Insecure Skill Coding Practices
- Location
SKILL.md:29- Finding
Potential Shell Command Injection Through User-Controlled Query Text
- Content
View full analysis
" ``` **If only `npx` is available (Node.js required):** ```bash npx -y @microsoft/workiq ask -q "" ``` ``` ### Technical Analysis The skill instructs the agent to execute WorkIQ through an `exec` tool and place natural-language query text directly inside a shell command. It does not require argument-array execution, validation, or shell-safe escaping. If the agent constructs the command by replacing the placeholder with user-controlled text, a malicious query containing a closing quotation mark and shell metacharacters could terminate the intended argument and introduce another command. Quoting the placeholder with double quotation marks does not make arbitrary input safe when the command itself is assembled as a string. The instruction on line 47 not to pipe or combine WorkIQ output with other commands discourages normal command composition, but it does not prevent injection inside the query argument. ### Attack Path 1. An attacker submits a Microsoft 365 query containing shell syntax designed to close the `-q` argument. 2. The agent substitutes that text into the documented command template. 3. The `exec` tool passes the resulting command string to a shell. 4. The shell interprets the injected metacharacters as executable syntax. 5. The injected command runs with the operating-system privileges and environment access of the agent process. Successful exploitation depends on the execution tool using a shell and the agent performing direct string interpolation. The skill does not mandate the safer non-shell execution model needed to eliminate this path. ### Impact Assessment An attacker could potentially execute arbitrary local commands ...[truncated 581 chars]- Remediation
View remediation
