T09 · Insecure Skill Coding Practices
- Location
SKILL.md:151- Finding
Shell Command Injection Through User-Derived Search Keywords
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 151-155
Vulnerability Type: Shell command injection
Risk Level: HighVulnerable code snippet:
text When the internal knowledge base does not contain a match and the question concerns tax policy or regulations: 1. Extract keywords from the question, prioritizing document number, tax type and subject, then broad terms. 2. Execute the search command: `catclaw-search "National Tax Administration {keyword}" --no-fast` 3. Retrieve the original policy: `web_fetch <result URL>`The snippet above is an English rendering of the instructions at the cited location; the executable command structure is preserved.
Technical Analysis
The Skill directs the Agent to derive
{keyword}from an untrusted user question and interpolate it into a command enclosed with double quotes. It does not require structured argument passing, shell escaping, metacharacter rejection, or an allowlist.If the runtime executes this command through a shell, double quotes do not neutralize command substitution, and an attacker may also close the quoted argument and introduce command separators. For example, a keyword shaped like
"; id; #would produce a command structurally equivalent to:bash catclaw-search "National Tax Administration "; id; #" --no-fastThe shell would interpret
idas a separate local command rather than as part of the search query. Similar input could invoke other binaries available to the Agent process.Attack Path
- An attacker submits a tax-policy question containing shell syntax in the portion likely to be extracted as a search keyword.
- The internal knowledge documents do not match the question, causing the fallback search workflow to run.
- The Agent inserts the attacker-controlled keyword into the documented command template.
- A shell-mediated tool runner parses the injected quote and command separator.
- T ...[truncated 751 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace command-string construction with a structured tool API that passes each argument separately:
text executable: catclaw-search arguments: - National Tax Administration <validated keyword> - --no-fast - Do not invoke the command through
sh -c,bash -c, or an equivalent shell interpreter. - Apply a strict length limit and character allowlist appropriate for tax search terms. Reject control characters, quotes, backticks, dollar signs, newlines, command separators, redirection operators, and shell expansion syntax.
- Keep the search process in a sandbox with minimal filesystem, credential, and network access.
- Add security tests covering quote termination, command substitution, newlines, separators, pipes, redirection, and Unicode control characters.
- Validate result URLs independently before passing them to
web_fetch, permitting only HTTPS and approved government domains where policy requires authoritative sources.
- Replace command-string construction with a structured tool API that passes each argument separately:
