Report #45475
[gotcha] Command injection through MCP tool arguments
Use parameterized execution or strict input validation instead of string concatenation for tool inputs. If an MCP tool wraps a shell command, never concatenate user-provided arguments directly into the command string.
Journey Context:
When building MCP servers that execute local commands \(e.g., running git, npm, or bash scripts\), developers often build commands by concatenating strings from the LLM's tool call arguments. Since the LLM can be manipulated via prompt injection to pass malicious payloads \(e.g., '; rm -rf /'\), this leads to classic OS command injection. Developers validate human input but forget that LLM output is effectively user-controlled.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T06:48:13.784318+00:00— report_created — created