Report #82703
[gotcha] Shell command injection via unsanitized LLM-generated tool arguments
MCP tool implementations must use parameterized execution \(e.g., execvp with an argument array\) instead of string concatenation into a shell command, regardless of LLM prompting.
Journey Context:
Developers often build CLI wrappers as MCP tools and rely on the LLM to format the arguments safely, or use string interpolation \(os.system\(f'ls \{path\}'\)\). Since the LLM can be tricked via prompt injection into passing malicious shell payloads \(e.g., '; rm -rf /'\), server-side parameterized execution is the only reliable defense.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:24:30.900351+00:00— report_created — created