T09 · Insecure Skill Coding Practices
- Location
SKILL.md:75- Finding
Shell Command Injection and Workspace Escape Through Unsanitized Placeholders
- Content
View full analysis
``` ```bash cd git init ``` ```bash touch . ``` ```bash cd ~/.nanobot/workspace/test/ ``` ```bash git commit -m "" ``` ### Technical Analysis The Skill instructs the Agent to interpolate script names, extensions, paths, and commit messages directly into shell commands. It does not require validation, shell-safe quoting, canonical path verification, or execution through an argument-array API. If a user-controlled value contains shell metacharacters such as `;`, `&&`, command substitutions, redirections, or newline characters, the shell may interpret those characters as additional commands. Script names containing `../`, path separators, or absolute-path syntax could also cause operations to escape `~/.nanobot/workspace/test`. The plan-confirmation requirement does not reliably mitigate this flaw. A malicious value can be presented in the plan and subsequently passed unchanged to a shell after confirmation. The vulnerable behavior occurs when an Agent follows these command templates literally. ### Attack Path 1. An attacker asks the Agent to create or modify a script and supplies a malicious script name, extension, or commit message. 2. The value includes shell control syntax or path traversal, such as a script name logically equivalent to `example; ` or `../../`. 3. The Agent inserts the value into one of the documented shell commands without validation or quoting. 4. The shell parses the injected syntax as an additional command, or the resolved path leaves the intended workspace. 5. The injected command runs with the Agent ...[truncated 663 chars]- Remediation
View remediation
