Report #2020
[gotcha] LLM constructs shell commands for a tool leading to command injection
Avoid tools that execute arbitrary shell commands or string-concatenate inputs into scripts. Use structured APIs, parameterized execution, or AST-based execution instead of shell execution.
Journey Context:
A developer creates a 'run\_python' or 'execute\_shell' tool. The LLM is asked to process a file named 'foo; rm -rf /'. The LLM builds the command 'python process.py foo; rm -rf /'. The tool executes it. The tool wasn't compromised; the LLM's string interpolation of untrusted input into a shell command was the vulnerability. Structured tools prevent this.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T09:35:22.088148+00:00— report_created — created