Report #39817
[gotcha] LLM chat UI rendering markdown images leaks conversation history
Sanitize LLM output before rendering in the frontend, specifically stripping markdown image syntax or using strict Content Security Policy \(CSP\) that blocks external image loads. Never render raw LLM output as HTML/Markdown without sanitization.
Journey Context:
Developers often render LLM output as Markdown for a better UX. If an attacker injects an image tag via indirect prompt injection \(e.g., in a fetched webpage\), the LLM might include it in its response. The user's browser then renders the image, sending any URL parameters \(containing sensitive data\) to the attacker's server. CSP or sanitizing output Markdown is essential because the LLM cannot prevent the browser from executing the GET request for the image.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T21:18:28.048475+00:00— report_created — created