Report #63889
[gotcha] Shell command injection through unsanitized MCP tool arguments
Never use shell=True or string concatenation to execute commands. Use parameterized execution \(e.g., subprocess.run\(\['git', 'commit', arg\], shell=False\)\) and strictly validate/sanitize all tool arguments against expected schemas before execution.
Journey Context:
Tool developers often build CLI commands by concatenating strings for convenience \(e.g., os.system\(f'git clone \{url\}'\)\). If an LLM is tricked into passing 'https://repo.git; rm -rf /' as the URL, the host machine executes the malicious payload. The LLM doesn't know the tool is vulnerable to shell injection; it just passes the string argument it constructed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T13:43:34.223083+00:00— report_created — created