T09 · Insecure Skill Coding Practices
- Location
SKILL.md:23- Finding
Unsafe shell interpolation of user-controlled search queries
- Content
View full analysis
" ``` ``` ### Technical Analysis The Skill instructs the Agent to substitute an untrusted user query directly into a quoted shell command. It does not require execution through an argument array, prohibit shell invocation, or specify shell-safe escaping. If the Agent constructs the documented command literally, a query containing a double quote followed by shell metacharacters can terminate the intended argument and introduce additional commands. Quoting the placeholder with literal double quotes is insufficient because the substituted value itself may contain a double quote. The Python script does not itself invoke a shell. The vulnerability exists in the Skill's invocation instructions and is exploitable when the Agent or runtime implements those instructions by constructing and executing a shell command. ### Attack Path 1. An attacker asks the Agent to search for a specially crafted query, such as: ```text "; id > /tmp/query-injection-proof; # ``` 2. The Agent substitutes the query into the documented template: ```bash python3 /path/to/scripts/tavily_search.py --query ""; id > /tmp/query-injection-proof; #" ``` 3. A shell parses the injected semicolons as command separators. 4. The Tavily script is invoked with an empty query, after which the injected command runs under the Agent process's operating-system identity. 5. The attacker may adapt the injected command to read accessible files, modify workspace data, invoke installed tools, or transmit locally accessible information. ### Impact Assessment Successful exploitation permits arbitrary command execution with the privileges of the user or service running the Agent. The accessible scope may incl ...[truncated 410 chars]- Remediation
View remediation
