T09 · Insecure Skill Coding Practices
- Location
SKILL.md:27- Finding
Shell Command Injection Through Unescaped User Input
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 27–30
Vulnerability Type: Shell command injection
Risk Level: HighVulnerable Code Snippet:
bash sentinel scan --input "USER_MESSAGE_HERE" --format jsonTechnical Analysis
The skill instructs the agent to place untrusted user input directly into a shell command. Wrapping the placeholder in double quotes does not make this construction safe: input containing a double quote can terminate the argument, while command substitutions such as
$()may be evaluated inside double quotes by a shell.If an implementation follows this instruction through a shell-based execution interface or constructs the command as a string, attacker-controlled syntax may be interpreted by the shell rather than passed solely as data to
sentinel. The security scan therefore becomes a potential code-execution boundary before the input has been determined to be safe.This finding applies when the documented command is implemented through shell interpretation. Direct process invocation with a correctly separated argument array would prevent this exploit.
Attack Path
- An attacker submits a user message containing shell syntax, such as a closing quotation mark followed by a command or a command-substitution expression.
- The agent replaces
USER_MESSAGE_HEREwith that message in the documented command string. - The agent passes the constructed string to a shell-based execution mechanism.
- The shell parses the injected syntax and runs the attacker-selected command.
- The injected command executes before or alongside the intended
sentinel scan, bypassing the purpose of the pre-execution safety gate.
Impact Assessment
Successful exploitation permits arbitrary command execution with the same operating-system privileges as the agent or process implementing the skill. Depending on that process's access, an attacker could read or modify local files, ac ...[truncated 353 chars]
- Remediation
View remediation
Remediation Suggestions
-
Do not interpolate user-controlled content into a shell command string.
-
Invoke
sentineldirectly with a structured argument array and disable shell processing. For example:python subprocess.run( ["sentinel", "scan", "--input", user_message, "--format", "json"], shell=False, check=False, capture_output=True, text=True, ) -
Alternatively, modify the interface to accept the message through standard input, avoiding command-line parsing of user content.
-
Explicitly state in
SKILL.mdthat implementations must not useshell=True,eval, textual command concatenation, or equivalent shell-evaluation facilities. -
Do not rely on manual escaping as the primary defense; use APIs that preserve argument boundaries.
-
Apply least privilege and sandboxing to the process that invokes
sentinelso that any future command-execution flaw has limited access to files, credentials, wallets, and the network. -
Add regression tests containing double quotes, semicolons, newlines, backticks,
$()expressions, and other shell metacharacters, verifying that each complete message reachessentinelas one literal argument.
-
