Report #66298
[gotcha] Command injection via unsanitized MCP tool string parameters
MCP server implementations must strictly validate and sanitize all string parameters. Never concatenate untrusted tool arguments directly into shell commands or SQL queries; use parameterized queries and safe APIs \(e.g., \`subprocess.run\` with an array instead of \`shell=True\`\).
Journey Context:
Developers building MCP servers often write quick Python/Node wrappers that pass arguments directly to system commands. An LLM manipulated by a prompt injection can craft a malicious string \(e.g., \`; rm -rf /\`\) as a tool argument. Because the MCP server runs with the user's local privileges, this results in immediate local code execution.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T17:45:30.737373+00:00— report_created — created