Report #57849
[gotcha] I parse the LLM structured JSON output with eval\(\) — it is my own model output so it is trusted
Never use eval\(\), exec\(\), or direct code execution on LLM output. Always parse structured output with safe parsers such as json.loads\(\) instead of eval\(\). Treat every byte of LLM output as untrusted user input in all downstream processing. Validate output schemas strictly. If the LLM generates code, run it in a sandbox with no network access and minimal filesystem permissions.
Journey Context:
Developers treat LLM output as trusted because it came from their model. But if the LLM was influenced by prompt injection, its output is effectively attacker-controlled. If you eval\(\) the LLM JSON response, you have given the attacker arbitrary code execution. If you pass LLM output to a SQL query without parameterization, you have created a SQL injection vector. If you render it as HTML, you have created an XSS vector. The LLM is a channel, not a trust boundary. Any influence over the LLM input \(direct or indirect\) is influence over its output, and therefore over any system that processes that output without sanitization.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T03:35:13.702789+00:00— report_created — created