T09 · Insecure Skill Coding Practices
- Location
SKILL.md:55- Finding
Unvalidated Package and Module Names Permit Shell Command Injection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 55-77
Vulnerability Type: Shell command injection through unvalidated command parameters
Risk Level: HighThe vulnerable command templates are:
bash npm install -g <package-name>@latest pip install --upgrade <package-name> brew upgrade <package-name> go get -u <module>Technical Analysis
The skill instructs the agent to substitute user-selected package or module names directly into shell commands. It does not require validation, shell escaping, quoting, rejection of option-like input, or use of argument-array execution APIs.
If attacker-controlled text is substituted into one of these placeholders and passed to a shell, metacharacters such as command separators, command substitutions, or redirection operators may be interpreted as shell syntax rather than as part of a package name. A leading hyphen may also be treated as a package-manager option and change command behavior.
Although updates require explicit user confirmation, that confirmation does not eliminate the flaw if the displayed package identifier conceals or includes malicious shell syntax.
Attack Path
- An attacker causes a crafted value to be used as a package or module name, such as through a user request, copied update list, or untrusted package metadata.
- The agent inserts the value directly into one of the documented command templates.
- The user confirms the update without recognizing the embedded shell syntax.
- The command is executed through a shell.
- The shell interprets the malicious portion as an additional command or altered command-line option.
- The injected operation runs with the same privileges and environment access as the agent process.
Impact Assessment
Successful exploitation can execute arbitrary commands with the privileges of the agent or invoking user. This may permit modification or deletion of acc ...[truncated 485 chars]
- Remediation
View remediation
Remediation Suggestions
- Validate every package or module identifier against the grammar supported by its package manager. Reject shell metacharacters, whitespace, control characters, redirection operators, and unexpected URL or path forms.
- Reject identifiers beginning with
-unless the relevant package manager explicitly supports and safely handles them. - Do not construct shell command strings. Invoke executables through an API that accepts an argument array, for example
["npm", "install", "-g", package + "@latest"]. - Where supported, insert an end-of-options delimiter (
--) before user-controlled positional arguments. - Resolve package selections from structured output produced by the corresponding package manager rather than accepting arbitrary free-form values.
- Display the exact executable and argument list to the user before execution and require confirmation for that precise command.
- Run updates with the minimum necessary privileges and avoid administrator or root execution unless separately justified and confirmed.
- Add explicit instructions that package metadata and user-provided identifiers must be treated as untrusted input.
