T09 · Insecure Skill Coding Practices
- Location
SKILL.md:37- Finding
Shell Command Injection Through an Unvalidated Deployment Prefix
- Content
View full analysis
Vulnerability Details
File Locations:
SKILL.md, lines 37-52 and 123-134README.md, lines 40-55, 65-75, and 85-110
Vulnerability Type: User-controlled input interpolated into shell commands without validation or quoting
Risk Level: HighAffected code from
SKILL.md:bash **Step 1:** Ask the user which role this agent should play and what prefix to use. **Step 2:** Install the skills for the chosen role: ```bash # prospector: clawhub install pilot-discover pilot-stream-data pilot-metrics # qualifier: clawhub install pilot-event-filter pilot-task-router pilot-dataset # outreach: clawhub install pilot-email-bridge pilot-cron pilot-receipt # crm-sync: clawhub install pilot-webhook-bridge pilot-audit-log pilot-slack-bridgeStep 3: Set the hostname:
bash pilotctl --json set-hostname <prefix>-<role>text ```bash # prospector <-> qualifier: pilotctl --json handshake <prefix>-qualifier "setup: sales-pipeline" pilotctl --json handshake <prefix>-prospector "setup: sales-pipeline" # qualifier <-> outreach: pilotctl --json handshake <prefix>-outreach "setup: sales-pipeline" pilotctl --json handshake <prefix>-qualifier "setup: sales-pipeline" # outreach <-> crm-sync: pilotctl --json handshake <prefix>-crm-sync "setup: sales-pipeline" pilotctl --json handshake <prefix>-outreach "setup: sales-pipeline"Affected code from
README.md:bash # On server 1 (lead prospecting) clawhub install pilot-discover pilot-stream-data pilot-metrics pilotctl set-hostname <your-prefix>-prospector # On server 2 (lead qualification) clawhub install pilot-event-filter pilot-task-router pilot-dataset pilotctl set-hostname <your-prefix>-qualifier # On server 3 (outreach) clawhub install pilot-email-bridge pilot-cron pilot-receipt pilotctl set-hostname <your-prefix>-ou ...[truncated 3033 chars]- Remediation
View remediation
Remediation Suggestions
- Validate the prefix before using it. Apply a strict allowlist such as
^[A-Za-z0-9][A-Za-z0-9_-]{0,62}$and reject all nonmatching values. - Place the validated value in a variable and quote every expansion:
bash prefix="$VALIDATED_PREFIX" pilotctl --json set-hostname "${prefix}-prospector" pilotctl --json handshake "${prefix}-qualifier" "setup: sales-pipeline" - Prefer direct process invocation with an argument array rather than generating and executing a shell command string.
- Do not use
eval,bash -c, or equivalent reparsing mechanisms with user-derived content. - Validate role names against the fixed set
prospector,qualifier,outreach, andcrm-sync. - Add an explicit instruction that the agent must reject whitespace, control characters, shell metacharacters, command substitutions, path separators, and leading hyphens in deployment identifiers.
- Apply the same validation and safe argument handling to hostname, handshake, subscribe, and publish examples in both documentation files.
- Validate the prefix before using it. Apply a strict allowlist such as
