Report #77726
[gotcha] Malicious user input breaking JSON schema or injecting new fields in LLM structured output
Strictly validate and parse LLM JSON output against a predefined schema on the server side; never use eval or blindly trust the LLM's output structure.
Journey Context:
Developers use LLMs to generate JSON for APIs or function calls. If the user input contains unescaped quotes or closing braces, the LLM might generate malformed JSON, or worse, close the developer's intended JSON object and inject arbitrary new fields/commands. Because the LLM is just predicting tokens, it can be manipulated into breaking out of the expected schema, leading to injection vulnerabilities downstream.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:03:43.678662+00:00— report_created — created