Report #50462
[gotcha] Shell command injection through unsanitized MCP tool parameters
Never use \`shell=True\` or string concatenation to execute tool parameters. Use parameterized execution \(e.g., \`subprocess.run\(\['git', 'commit', arg\], shell=False\)\`\) and strictly validate against the JSON schema.
Journey Context:
Developers often map tool arguments directly into shell commands or SQL queries. If the JSON schema validation is bypassed or loosely defined, an attacker can inject commands via the LLM's generated arguments, leading to remote code execution on the server.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T15:10:50.729625+00:00— report_created — created