T09 · Insecure Skill Coding Practices
- Location
SKILL.md:28- Finding
Unquoted Path Parameters May Enable Shell Command Injection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 28–35
Vulnerability Type: Command injection through unsafe shell command construction
Risk Level: MediumVulnerable Code:
bash python3 ${CLAUDE_PLUGIN_ROOT}/scripts/graph_build.py <dir>bash python3 ${CLAUDE_PLUGIN_ROOT}/scripts/graph_build.py <dir> --incrementalTechnical Analysis
The documented commands interpolate both the environment-derived
CLAUDE_PLUGIN_ROOTvalue and a user-specified directory into shell command lines without quoting or validation. Paths containing whitespace may break argument boundaries, while shell metacharacters in a substituted directory value could be interpreted as additional shell syntax.Exploitation depends on an agent replacing the
<dir>placeholder with untrusted text and passing the resulting command through a shell. A manipulatedCLAUDE_PLUGIN_ROOTcould also redirect execution to an unintended local script. The referencedgraph_build.pyis external to the audited project and therefore could not be reviewed within the available scope.Attack Path
- An attacker supplies a crafted directory value containing shell metacharacters and an additional command.
- The agent substitutes that value directly for the documented
<dir>placeholder. - The agent executes the constructed command through a command shell.
- The shell interprets the injected syntax rather than treating the complete value as a single path argument.
- The attacker-controlled command executes with the same operating-system privileges as the agent process.
Alternatively, an attacker who can manipulate
CLAUDE_PLUGIN_ROOTmay cause Python to execute a different localscripts/graph_build.pyfile.Impact Assessment
Successful exploitation could permit arbitrary local command execution with the privileges of the process invoking the skill. This may expose or modify files access ...[truncated 262 chars]
- Remediation
View remediation
Remediation Suggestions
-
Do not construct commands by concatenating or interpolating untrusted strings into shell command text.
-
Invoke the process through an argument-array API without a shell, such as Python
subprocess.run([...], shell=False, check=True). -
Resolve the target directory to a canonical path and verify that it exists and is a directory before execution.
-
Resolve and validate
CLAUDE_PLUGIN_ROOT, and verify thatscripts/graph_build.pyis the expected trusted file. -
If a shell command must be documented, quote both paths and use an end-of-options delimiter supported by the script:
bash python3 "${CLAUDE_PLUGIN_ROOT}/scripts/graph_build.py" -- "$dir" -
Ensure
graph_build.pysupports--and independently validates the target path. -
Avoid accepting raw shell expressions as directory input and reject control characters or malformed path values.
-
