T09 · Insecure Skill Coding Practices
- Location
SKILL.md:43- Finding
Shell Command Injection Through Unsafely Interpolated Shortcut Names
- Content
View full analysis
`: Exact name of the shortcut (use quotes if name contains spaces) ``` ### Technical Analysis The skill instructs the agent to place a shortcut name into a shell-command template. It recommends enclosing the value in double quotes but does not require shell-free process execution, validation, or platform-correct escaping. Double quotes alone are not a safe defense when an untrusted value is used to construct a command string. A value containing a closing quote, command substitution, or other shell syntax may alter the resulting command. For example, interpolating a name such as `x"; malicious-command; #` could produce: ```bash shortcuts run "x"; malicious-command; #" ``` If the agent passes this generated string to a shell, the shell runs `malicious-command` separately from the intended `shortcuts` invocation. Command substitution syntax may also be evaluated inside double quotes when the assembled value is interpreted as shell source. The same unsafe usage pattern is repeated in `README.md`, lines 32-45. Exploitability depends on the execution layer constructing and evaluating a shell command string rather than passing the shortcut name as a distinct process argument. ### Attack Path 1. An attacker supplies or requests a shortcut name containing shell syntax, such as `x"; malicious-command; #`. 2. The agent follows the documented template and inserts that value between literal double quotes. 3. The agent or its command-execution tool submits the assembled command through a shell. 4. The injected quote terminates the intended shortcut-name argument. 5. The shell interprets the remaining text as an additional command. 6. The injected command executes with the operating-system priv ...[truncated 816 chars]- Remediation
View remediation
