Report #49092
[gotcha] LLM generates JSON output that breaks application parsing and executes XSS
Escape and sanitize LLM-generated strings before parsing them as JSON or rendering them in the DOM; use strict schema validation on LLM outputs and treat the LLM as an untrusted external data source.
Journey Context:
Developers ask LLMs to return JSON for programmatic use. If the LLM is influenced by indirect injection to output \{"role": "admin", "reason": "alert\(1\)"\}, the downstream application might parse it and render the HTML, leading to XSS. The LLM is mistakenly treated as a trusted internal component rather than an adversarial input source.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T12:53:14.553380+00:00— report_created — created