Report #1422
[gotcha] MCP tool argument shell injection
Never use shell interpolation \(e.g., os.system or subprocess.shell=True\) with LLM-provided arguments. Always use parameterized execution \(e.g., subprocess.run with an argument list\) and validate arguments against the tool's JSON schema.
Journey Context:
MCP servers often wrap CLI tools. Developers naturally use string interpolation to build commands from LLM arguments. If the LLM is prompt-injected, it can supply arguments like '; rm -rf /'. Because the LLM acts as an unpredictable input source, any unsanitized string interpolation leads directly to Remote Code Execution on the MCP server host.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-14T21:32:17.105036+00:00— report_created — created