T09 · Insecure Skill Coding Practices
- Location
plugin.ts:217- Finding
Shell Command Injection Through the Download Directory Parameter
- Content
View full analysis
/tmp/aria2-rpc.log 2>&1 &`; exec(cmd, (err2) => { ``` ### Technical Analysis The `downloadDir` value can be supplied through the `bt_start_rpc` tool and is interpolated directly into a command string executed by `child_process.exec`. Although it is surrounded by double quotes, the value is not escaped or validated. Because `exec` invokes the command through a shell, a malicious value containing a double quote followed by shell metacharacters can terminate the `--dir` argument and append another command. Quoting the interpolated value is therefore insufficient to prevent command injection. The vulnerable operation runs with the same operating-system privileges as the plugin host. The input schema does not provide a security boundary and cannot replace contextual shell escaping or shell-free process execution. ### Attack Path 1. An attacker or untrusted agent invocation calls `bt_start_rpc`. 2. The attacker supplies a crafted `downloadDir` containing a closing quote and shell syntax. 3. The handler inserts the value into the `cmd` template without validation or escaping. 4. `child_process.exec` passes the resulting string to the operating-system shell. 5. The shell interprets the injected metacharacters and executes the appended command. 6. The injected command runs with the privileges of the OpenClaw/plugin process. ### Impact Assessment Successful exploitation permits arbitrary command execution under the plugin process's user account. Depending on that account's permissions, an attacker could: - Read, modify, or delete fi ...[truncated 554 chars]- Remediation
View remediation
