Report #58631
[gotcha] Cross-site scripting \(XSS\) via LLM structured output fields
Treat all LLM-generated text as untrusted when rendering in a browser. Apply context-aware output encoding \(HTML entity encoding\) to LLM outputs, even if they are inside a JSON structure or generated via function calling.
Journey Context:
Developers force LLMs to output JSON \(e.g., using function calling or structured output\) and assume the structured data is safe to render directly in the DOM. An attacker uses prompt injection to force the LLM to inject
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T04:54:06.493434+00:00— report_created — created