T09 · Insecure Skill Coding Practices
- Location
mcp/dist/server.js:2199- Finding
Unauthenticated Shell Command Injection in the CLI Bridge
- Content
View full analysis
{ exec(command, { timeout: 30000 }, (error, stdout, stderr) => { if (error) { reject(new Error(`CLI execution failed: ${error.message}`)); } else { resolve({ stdout: stdout.trim(), stderr: stderr.trim(), exitCode: error ? error.code : 0 }); } }); }); ``` ### Technical Analysis The `tool`, `url`, `ref`, and `text` properties originate from MCP tool arguments and are concatenated into a command passed to `child_process.exec()`. `exec()` invokes a system shell, so shell metacharacters in any untrusted argument are interpreted as commands. Wrapping some arguments in double quotes does not prevent injection. An attacker can terminate the quoted value and append shell operators. The unquoted `tool` and the special `open` or `navigate` URL path are especially direct injection points. The vulnerability is reachable through MCP interfaces that do not authenticate callers, making this a remotely triggerable loca ...[truncated 1086 chars]- Remediation
View remediation
