Report #54506
[gotcha] Passing LLM-generated arguments directly into shell commands or eval statements
Use parameterized execution \(e.g., subprocess.run with an argument list\) instead of shell=True or string concatenation. Validate and sanitize all LLM-generated inputs against a strict schema.
Journey Context:
When an LLM calls a tool like run\_command\(file\_name\), developers often use os.system\('cat ' \+ file\_name\). A prompt injection can cause the LLM to pass 'file.txt; rm -rf /' as the argument. Because the LLM acts as a user proxy, any unsanitized input passed to a shell leads directly to classic OS command injection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T21:59:04.199481+00:00— report_created — created