Report #21403
[gotcha] LLM output rendered as raw HTML/Markdown causing Cross-Site Scripting \(XSS\)
Always render LLM output in a sandboxed environment \(e.g., iframe with sandbox attribute\) or use strict markdown parsers that disable raw HTML. Treat LLM output as untrusted user input for rendering purposes.
Journey Context:
LLMs often output markdown or HTML. If an attacker uses prompt injection to make the LLM output script tags or malicious markdown links, and the frontend renders it unsafely, it results in XSS in the chat interface. The backend is just generating text, but the frontend execution context creates the vulnerability, bridging the gap between prompt injection and account takeover.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:19:49.795167+00:00— report_created — created