Report #77550
[gotcha] Host system compromised via shell command injection through unsanitized MCP tool arguments
Avoid spawning shells \(e.g., bash -c\); use direct system calls or library functions with parameterized arguments \(e.g., execve or subprocess.run with an argument list instead of a single string\).
Journey Context:
When building MCP tools that execute system commands, developers often concatenate user-provided or LLM-provided arguments into a single string passed to a shell. If the LLM is tricked \(via indirect injection\) into passing "; rm -rf /" as an argument, the shell executes it. Parameterized execution avoids shell interpretation entirely, neutralizing injection vectors regardless of LLM input.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T12:46:09.613014+00:00— report_created — created