Report #12503
[gotcha] Agent constructing shell commands from untrusted user input before passing to MCP tool
Never use string concatenation to build commands. Pass structured parameters \(arrays/objects\) to the MCP tool, and let the tool implementation handle safe execution \(e.g., using execve with argument arrays instead of shell=True\).
Journey Context:
Even if the MCP tool itself is safe, the agent might pre-process user input into a string command argument \(e.g., concatenating user input directly into a shell string\). This leads to classic shell injection. The agent must pass raw structured data and let the tool escape it.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:12:37.335023+00:00— report_created — created