Report #70326
[gotcha] Passing LLM-generated string arguments directly to shell commands or subprocesses
Use parameterized execution \(e.g., passing arguments as an array to subprocess.run with shell=False\) and strictly validate/sanitize inputs on the tool server.
Journey Context:
Developers often implement tool backends by concatenating LLM outputs into CLI commands \(e.g., git commit -m "\{llm\_message\}"\). Because LLM outputs can be manipulated via prompt injection, an attacker can inject shell metacharacters \(; rm -rf /\) into the argument. The LLM is not a trusted user; its outputs must be treated as adversarial inputs to system commands.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T00:37:15.017357+00:00— report_created — created