T09 · Insecure Skill Coding Practices
- Location
references/sandbox-procedure.md:13- Finding
Unvalidated Skill Identifier Is Interpolated into Shell Commands
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:30-32,references/sandbox-procedure.md:13-14
Vulnerability Type: Command injection through unvalidated input
Risk Level: HighVulnerable Code
SKILL.md:30-32:markdown Parse the skill identifier: - Full URL: `https://clawhub.ai/author/skill-name` - Short: `skill-name` or `author/skill-name`references/sandbox-procedure.md:13-14:text 1. openclaw skill install {skill-name} 2. SKILL_PATH=~/.openclaw/workspace/skills/{skill-name}Technical Analysis
The workflow accepts a skill identifier and inserts
{skill-name}directly into commands represented as shell syntax. It does not require validation against a restrictive identifier grammar, shell escaping, argument separation, or path canonicalization.If the generated task is interpreted by a shell, an identifier containing whitespace, command separators, command substitution, redirection, or path traversal sequences could change the intended command. The assignment to
SKILL_PATHis also unquoted, allowing shell expansion and unintended argument splitting in subsequent commands.Exploitability depends on the sub-agent executing these instructions through a shell, as the procedure directs. The project does not define a safe command API that would prevent shell interpretation.
Attack Path
- An attacker supplies a crafted value where the workflow expects
{skill-name}. - The primary Agent accepts the value because no strict validation rule is defined.
- The value is copied into the sandbox task:
text openclaw skill install {skill-name} - The sub-agent executes the generated command through a shell.
- Shell metacharacters in the supplied value alter the command or introduce an additional command.
- The injected command runs with the privileges and resource access granted to the sub-agent.
Impact Assessment
Successful exploitati ...[truncated 606 chars]
- An attacker supplies a crafted value where the workflow expects
- Remediation
View remediation
Remediation Suggestions
- Validate identifiers before creating any task or command. For example, permit only canonical identifiers matching:
regex ^[A-Za-z0-9._-]+(/[A-Za-z0-9._-]+)?$ - Reject whitespace, shell metacharacters, control characters, absolute paths, and
..path components. - Resolve and verify derived paths remain under the expected skills directory.
- Use a structured process-execution API with an argument array rather than constructing shell command strings.
- If shell execution is unavoidable, quote every argument using a platform-appropriate escaping function; do not rely on manual interpolation.
- Treat URLs separately: parse them with a URL parser, validate the expected host, and extract only validated author and skill path components.
- Add negative tests covering semicolons, command substitution, spaces, newlines, redirection, globbing, and path traversal.
- Validate identifiers before creating any task or command. For example, permit only canonical identifiers matching:
