Report #41419
[gotcha] Passing LLM-generated tool arguments directly to shell commands
Use parameterized execution \(e.g., subprocess.run with an array of args\) instead of shell=True; never concatenate LLM outputs into shell strings.
Journey Context:
It is tempting to build a dynamic bash command using arguments the LLM extracted from user input for a tool like run\_command. If the LLM is tricked via indirect prompt injection into passing a malicious string, and the tool executes with shell=True, it results in command injection. Parameterized execution treats the LLM's output as a literal string, not executable code, neutralizing the injection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T23:59:42.796504+00:00— report_created — created