T09 · Insecure Skill Coding Practices
- Location
reference.md:64- Finding
Unvalidated Skill Identifier May Enable Shell Command Injection
- Content
View full analysis
Vulnerability Details
File Location:
reference.md:64-66
Vulnerability Type: Command injection through unsafe command construction
Risk Level: HighVulnerable Code
text clawhub search <slug> --channel clawhub-cn clawhub info <slug> --channel clawhub-cn clawhub install <slug> --channel clawhub-cn clawhub update <slug> --channel clawhub-cn clawhub search <slug> --channel clawhub-global clawhub info <slug> --channel clawhub-global clawhub install <slug> --channel clawhub-global clawhub update <slug> --channel clawhub-global clawhub search <slug> --channel skillhub clawhub info <slug> --channel skillhub clawhub install <slug> --channel skillhub clawhub update <slug> --channel skillhubTechnical Analysis
The documented workflow derives the skill slug from requests such as installing or updating a user-selected skill and substitutes it into command templates. No slug validation, escaping requirement, or safe process-execution mechanism is specified.
If an implementing agent constructs a command string and passes it to a shell, a slug containing shell metacharacters could alter the command's structure. Relevant characters include command separators, substitutions, redirections, and newline characters. The vulnerability is especially significant because installation and update operations are expected to execute local commands.
The finding is an insecure command-construction practice rather than evidence that this package itself contains an executable malicious payload. Exploitation depends on an agent or implementation executing the templates through a shell without independently sanitizing the slug.
Attack Path
- An attacker supplies a crafted skill name or slug containing shell syntax.
- The agent follows the documented installation, search, information, or update workflow.
- The unvalidated value i ...[truncated 878 chars]
- Remediation
View remediation
Remediation Suggestions
-
Enforce a strict slug allowlist before any command or filesystem operation. For example:
regex ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ -
Reject slugs containing whitespace, path separators, traversal components, shell metacharacters, control characters, or newline characters.
-
Execute commands using an argument array rather than a concatenated shell string. For example:
python subprocess.run( ["clawhub", "info", slug, "--channel", channel], shell=False, check=True, timeout=60, ) -
Allowlist channel values to
clawhub-cn,clawhub-global, andskillhub. -
Add explicit instructions that agents must never pass these templates to
sh -c,bash -c, or an equivalent shell. -
Apply execution timeouts, capture output safely, and avoid exposing environment secrets to child processes unless required.
-
Add tests using hostile values containing separators, substitutions, redirections, traversal sequences, whitespace, and newlines.
-
