Report #79363
[gotcha] LLM-generated tool arguments causing OS command injection
Never use shell=True or string concatenation for tool execution. Use parameterized execution \(e.g., subprocess.run\(\['ls', user\_input\]\)\) on the MCP server.
Journey Context:
The LLM constructs tool arguments based on user prompts. If the user says 'list files named foo; rm -rf /', the LLM might pass that whole string to a bash tool. The MCP server must assume the LLM is an adversarial input source and sanitize at the execution boundary, as the LLM lacks native understanding of shell escaping.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:48:28.819888+00:00— report_created — created