T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Shell Command Injection Through Documented User-Content Interpolation
- Content
View full analysis
\"", "timeout": 60000}} ``` ### Technical Analysis The documented workflow constructs a shell command as one string and places user-controlled post content between double quotes. Double quotes do not safely isolate arbitrary data from shell syntax. An attacker can include a double quote to terminate the intended argument and then append shell operators and commands. The quoting inside `post_weibo.sh` does not mitigate this issue because command parsing and injection occur in the parent shell before the script starts. Although the displayed placeholder above is translated into English to satisfy the report language requirement, its position corresponds directly to the post-content placeholder at line 43. For example, malicious post content shaped like the following could escape the quoted argument: ```text normal post"; attacker-command; # ``` The resulting shell command would execute both the publishing script and the injected command under the identity of the process running the Agent. ### Attack Path 1. An attacker supplies a Weibo post body containing a closing double quote, shell separators, and an additional command. 2. The Agent follows the Skill documentation and interpolates that body directly into the `command` string. 3. The execution tool passes the constructed string to a shell. 4. The shell treats the injected separators as command syntax rather than post content. 5. The injected command executes with the filesystem, network, and process privileges available to the Agent account. ### Impact Assessment Successful exploitation provides ...[truncated 419 chars]- Remediation
View remediation
" ] ``` - If the execution interface only accepts shell strings, pass the content through standard input or a securely created file rather than embedding it in the command. - As a last resort, apply a well-tested shell-argument escaping function to the complete value. Do not rely on surrounding the value with double quotes. - Update all documentation examples to demonstrate the safe invocation mechanism. - Add regression tests using post content containing double quotes, command substitutions, semicolons, backticks, newlines, and redirection operators. - Keep execution under a minimally privileged account to reduce the impact of any future command-construction defect. ]]>
