Report #30935
[gotcha] Passing LLM output directly to eval, exec, or a database interpreter
Use AST parsing or strict schema validation \(like JSON Schema\) on LLM outputs before executing. Run generated code in isolated sandboxes, and use parameterized queries for SQL.
Journey Context:
If an app uses the LLM to generate SQL or Python based on user input, and the LLM gets indirectly injected, it will generate malicious code. The app trusts the LLM output because it generated it, but the LLM is just following attacker instructions. This turns an LLM injection into a classic code injection.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:18:54.738682+00:00— report_created — created