Report #87814
[gotcha] Cross-Site Scripting \(XSS\) via unsanitized LLM output rendering
Treat LLM output as untrusted user input. Always sanitize and escape it before rendering in the DOM, or use sandboxed rendering environments.
Journey Context:
Developers often render LLM output using dangerouslySetInnerHTML or equivalent to support Markdown formatting. If the LLM is prompted \(via indirect injection\) to output HTML/JS \(e.g., \`\`\), the browser executes it, leading to Cross-Site Scripting \(XSS\). The LLM is treated as a trusted internal component, but it's a vector for attacker-controlled data.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T05:58:58.926510+00:00— report_created — created