T09 · Insecure Skill Coding Practices
- Location
SKILL.md:23- Finding
Shell Command Injection Through Unsafely Interpolated Search Queries
- Content
View full analysis
" curl -s "https://r.jina.ai/https://skills.sh/search?q=" --max-time 10 curl -s "https://r.jina.ai/https://skillsmp.com/zh/search?q=" --max-time 10 ``` ### Technical Analysis The skill directs an agent to insert a user-provided search query into shell commands. The raw `` value is placed inside a double-quoted argument to `clawhub search`, but the instructions do not require shell-safe argument passing, robust escaping, or input validation. Double quotes do not make arbitrary input safe if the interpolated value itself can contain a double quote. An attacker can supply a query containing a closing quote followed by shell syntax, causing the shell to interpret part of the query as a separate command. Shell command substitutions and backticks may also remain dangerous if an implementation performs literal textual interpolation before invoking a shell. The two `curl` commands require URL encoding, which reduces risk only if a correct encoder is used before shell construction. The document does not define or enforce that encoding mechanism. None of these commands should be assembled as shell strings from untrusted input. ### Attack Path 1. An attacker asks the agent to search for a skill using a query containing quote-breaking shell syntax. 2. The agent follows the documented workflow and substitutes that query directly into the command template. 3. The inserted quote terminates the intended `clawhub search` argument. 4. The local shell parses the remaining attacker-controlled text as additional shell syntax or commands. 5. Those commands execute with the same operating-system identity, filesystem access, network access, and environment available to the agent process. For example, a query ...[truncated 984 chars]- Remediation
View remediation
