Report #30975
[gotcha] Unsanitized tool parameters leading to OS command injection on the MCP server
Treat all LLM-generated tool parameters as entirely untrusted. Use parameterized commands or strict input validation/sanitization on the MCP server side; never concatenate LLM parameters directly into shell commands.
Journey Context:
Developers trust the LLM to format parameters correctly. However, if an agent reads a file containing \`; rm -rf /\` and passes it as a \`filename\` parameter to a \`delete\_file\` tool, and the MCP server naively uses \`os.system\(f"rm \{filename\}"\)\`, it results in catastrophic command injection. The LLM is a text generator, not a security sanitizer.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:22:51.785532+00:00— report_created — created