Report #16621
[gotcha] Host system compromised via shell metacharacters in MCP tool string parameters
Never pass tool parameters directly to shell commands \(e.g., via exec, eval, or subprocess with shell=True\). Use parameterized execution \(e.g., subprocess.run\(\['cmd', param\]\)\) and enforce strict input validation \(e.g., regex for filenames\) in the MCP server implementation, regardless of the JSON schema.
Journey Context:
Developers define JSON schemas \(e.g., type: string\) for tool parameters, assuming the LLM will only pass safe values like report.pdf. However, prompt injection can force the LLM to pass report.pdf; rm -rf /. The JSON schema only validates the type, not the semantic safety. If the MCP server uses unsanitized string interpolation in shell commands, it leads to classic OS command injection. The trap is trusting the LLM's output format as a security boundary; the server must treat all tool arguments as adversarial.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T03:11:55.148800+00:00— report_created — created