T09 · Insecure Skill Coding Practices
- Location
SKILL.md:184- Finding
Unsafe Shell Command Templates Permit Command Injection
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:184
Vulnerability Type: Unsafe construction of shell commands from target values
Risk Level: HighVulnerable Code Snippet:
bash npx tsc --noEmit target.tsThis command is one of multiple verification templates that place a target filename or path directly into a shell command. Other checks in the same document similarly instruct the Agent to substitute target paths into commands such as
stat,grep, and language parsers.Technical Analysis
The Skill does not define a safe argument-passing mechanism, canonical-path validation, or rejection of shell metacharacters. If an implementation replaces
target.tsor analogous placeholders with an attacker-controlled target and executes the result through a shell, characters such as semicolons, command substitutions, redirections, or newlines can alter the command structure.Quoting alone would not be sufficient if the implementation builds a command string incorrectly or invokes a shell with attacker-controlled content. The target must be passed as a discrete process argument.
Attack Path
- An attacker creates or identifies a target whose supplied path includes shell syntax.
- The attacker requests a hallucination check against that target.
- The Agent substitutes the supplied value into one of the documented shell templates.
- The generated string is passed to a shell.
- The shell interprets the injected syntax and executes the attacker's additional command.
This path depends on an Agent implementing the documented placeholders through shell-string interpolation rather than safe argument arrays.
Impact Assessment
Successful exploitation can execute arbitrary commands with the operating-system privileges of the Agent. Depending on the execution environment, this may allow reading accessible files and credentials, modifying the audited repository, initiating network requests, or c ...[truncated 51 chars]
- Remediation
View remediation
Remediation Suggestions
- Never concatenate a target path into a shell command string.
- Invoke tools through structured process APIs with argument arrays.
- Canonicalize targets and restrict them to the explicitly approved project root.
- Reject paths containing control characters or unexpected shell metacharacters.
- Insert
--before positional path arguments when the invoked tool supports it. - Quote shell variables consistently where shell use is unavoidable.
- Run verification commands in a sandbox with minimal filesystem and network permissions.
- Add regression tests using paths containing spaces, newlines, semicolons, command substitutions, and leading hyphens.
