Report #7381
[gotcha] Dynamically constructing shell commands from untrusted tool parameters without strict validation
Use parameterized execution \(e.g., subprocess.run with an array of args\) instead of shell=True. Never interpolate tool arguments directly into shell strings.
Journey Context:
When an MCP server wraps a CLI tool, developers often use string formatting \(e.g., os.system\(f'git clone \{url\}'\)\). A malicious LLM \(or a prompt-injected LLM\) can pass url = 'https://repo.com; rm -rf /'. Because the LLM is the user in this context, and its inputs can be manipulated by external text, tool arguments must be treated as highly adversarial, second-order user input. Parameterized execution breaks the ability to chain shell metacharacters.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T02:37:59.806005+00:00— report_created — created