T09 · Insecure Skill Coding Practices
- Location
SKILL.md:33- Finding
Shell Command Injection Through Unvalidated Deployment Prefix
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:33,SKILL.md:46-48, andSKILL.md:154-165
Vulnerability Type: Command injection through unquoted, user-controlled shell input
Risk Level: HighThe Skill instructs the agent to request a deployment prefix from the user and interpolate that value directly into Bash commands without validation or shell-safe argument handling.
markdown **Step 1:** Ask the user which role this agent should play and what prefix to use.The prefix is subsequently inserted into commands such as:
bash pilotctl --json set-hostname <prefix>-<role> mkdir -p ~/.pilot/setupsIt is also used without quoting in the handshake commands:
bash # content-curator <-> tutor: pilotctl --json handshake <prefix>-tutor "setup: ai-tutoring-system" pilotctl --json handshake <prefix>-content-curator "setup: ai-tutoring-system" # tutor <-> assessor: pilotctl --json handshake <prefix>-assessor "setup: ai-tutoring-system" pilotctl --json handshake <prefix>-tutor "setup: ai-tutoring-system" # assessor <-> content-curator: pilotctl --json handshake <prefix>-content-curator "setup: ai-tutoring-system" pilotctl --json handshake <prefix>-assessor "setup: ai-tutoring-system"Technical Analysis
The Skill grants access to Bash and explicitly asks for a user-supplied prefix. No character allowlist, length restriction, normalization rule, or shell escaping requirement is specified before the prefix is substituted into commands.
If an agent performs textual substitution and invokes the resulting command through a shell, metacharacters in the prefix—such as semicolons, command substitutions, redirection operators, or logical operators—can alter command structure. Quoting alone would reduce some risks, but strict validation and argument-array execution are preferable.
The role placeholder should also be r ...[truncated 1388 chars]
- Remediation
View remediation
Remediation Suggestions
- Validate the prefix before any use with a strict allowlist, such as
^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$. - Reject prefixes containing whitespace, shell metacharacters, path separators, control characters, command substitutions, or leading hyphens.
- Restrict the role to the exact enumerated values
content-curator,tutor, orassessor. - Avoid constructing command strings. Invoke
pilotctlusing an argument array or an execution API that does not pass values through shell parsing. - If Bash is unavoidable, validate first, use
--where supported, and quote every substituted value, for example:bash pilotctl --json set-hostname -- "${prefix}-${role}" pilotctl --json handshake -- "${prefix}-tutor" "setup: ai-tutoring-system" - Display the normalized hostname to the user and request confirmation before executing state-changing commands.
- Apply the same validation requirements to every command in
SKILL.mdandREADME.mdthat uses the deployment prefix.
- Validate the prefix before any use with a strict allowlist, such as
