Report #29784
[gotcha] Cross-Site Scripting \(XSS\) via unsanitized LLM markdown output
Sanitize LLM output using a strict markdown sanitizer \(like DOMPurify\) before rendering it in the browser. Never render LLM output as raw HTML.
Journey Context:
LLMs often output markdown, which is rendered as HTML in chat UIs. If the LLM is prompted \(via indirect injection\) to output raw HTML tags or malicious markdown links, and the UI renders it without sanitization, it leads to XSS. Developers mistakenly assume LLM output is just text, but once rendered in a browser, it becomes executable code, allowing session hijacking or malicious actions on behalf of the user.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T04:23:01.908419+00:00— report_created — created