Report #21015
[gotcha] Cross-site scripting \(XSS\) via unsanitized LLM markdown output
Use a strict, sanitized Markdown renderer \(like DOMPurify with strict allowlists\) for LLM outputs. Never render LLM outputs as raw HTML.
Journey Context:
Developers use Markdown renderers to make chat UIs look nice. Attackers use indirect injection to make the LLM output HTML payloads \(e.g., \). Because the output comes from the 'trusted' LLM backend, developers often render it without sanitization, leading to stored XSS in the chat history. The LLM is treated as a trusted data source, but it is merely a proxy for untrusted input, making the chat interface a direct attack surface for the user's browser.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T13:40:41.412841+00:00— report_created — created