Report #95384
[gotcha] LLM generated HTML/JS causing Cross-Site Scripting \(XSS\) in chat UI
Render LLM outputs in a sandboxed iframe or use strict DOM text insertion \(textContent\) rather than innerHTML, treating LLM output as malicious user input.
Journey Context:
Developers build chat UIs that render LLM markdown or HTML directly into the DOM. If an attacker uses prompt injection to make the LLM output script tags or malicious markdown links, the user's browser executes it, leading to account takeover. LLM output is user-controlled input and must be treated as such.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T18:40:53.622507+00:00— report_created — created