Skip to main content

Markdown Image Exfiltration: How Chatbots Leak Data Through Images

· By Natalie Walls

Markdown image exfiltration is when a prompt injection gets an AI chatbot to output a Markdown image whose URL contains private data. When the chat window renders the image, the browser requests that URL, and the data lands on the attacker's server. Nobody has to click anything.

Simon Willison sums it up as tricking the bot into rendering an image "that leaks data encoded in the URL to an external server" on his markdown exfiltration tag page, which tracks many reported cases.

How markdown image exfiltration works

There are three steps.

  1. Injection. Instructions reach the model through something it reads: an email, a web page, a code file, an issue.
  2. Encoding. The instructions tell the model to gather some private data and put it into an image URL, often as a query parameter.
  3. Rendering. The chat interface displays the Markdown as an image. The browser fetches the URL, and the request itself delivers the data.

Here's what that output looks like, using a harmless canary instead of real data:

![status](https://example.com/pixel.png?note=CANARY-7)

If your app renders that and your network logs show a request to example.com with CANARY-7 in it, the leak path exists. In a real attack, the domain would belong to the attacker and the parameter would hold your data. Attackers often use a tiny or invisible image so the user sees nothing odd.

This is the external communication leg of the lethal trifecta. Willison describes it that way: private data, untrusted content, and a way out.

Real cases

ChatGPT, 2023. Willison linked to a write-up by Roman Samoilenko in April 2023. A website altered copied text so that a user pasting it into ChatGPT would trigger an injection, and the chat data went out through a single-pixel image. Willison's post notes OpenAI began mitigating it in December 2023.

GitLab Duo, 2025. In May 2025, Omer Mayraz of Legit Security showed hidden instructions in a public project's source code making GitLab Duo read a private merge request, base64 encode the change, and put it in an image URL on an outside domain. Willison called it another example of "the classic Markdown image exfiltration attack." GitLab fixed it by allowing links and images only to trusted domains.

Others. Willison's tag page lists many more, including Mistral's Le Chat, which fixed its issue by locking down Markdown images, and EchoLeak in Microsoft 365 Copilot, where reference-style Markdown slipped past filters and a broadly trusted domain hosted an open redirect.

Why allowlists alone can fail

Several cases on Willison's page share a pattern: the app had an allowlist or Content Security Policy, but something on an allowed domain could still receive data. Examples he lists include an open redirect on a trusted domain, a form service on an allowed domain that stored whatever was sent to it, and an expired domain left in a policy that researchers registered.

So an allowlist is only as good as every domain on it.

How to block markdown image exfiltration

Don't render images from model output, or only from your own domains. Willison argues chat interfaces shouldn't render arbitrary Markdown images at all. If you need images, allow your own hosts and nothing else.

Block it deterministically. Microsoft's security team says it blocked markdown image injection and similar link variants as a fixed rule, not a model judgment. That's the right instinct: this leak path is easy to close in code.

Audit your allowlist. Check every allowed domain for open redirects, public forms, webhooks or anything else that accepts data in a URL. Remove domains you no longer control.

Handle every Markdown form. Inline images, reference-style images and links all need the same check. EchoLeak got through on reference-style syntax.

Check output after it's complete. GitLab Duo's filter was bypassed by streaming output, so validate the final rendered content, not just chunks.

Treat links with care too. Links need a click, but they leak the same way. Apply the same domain rules.

Test it in five minutes

  1. Put a harmless instruction in a document your app reads, asking the model to show the canary image above.
  2. Ask the app a normal question about that document.
  3. Watch your network log for a request to example.com.
  4. If you see one, your renderer will load whatever URL the model writes.

Our home page canaries give you harmless payloads to start from, and How to Prevent Prompt Injection covers the wider set of defenses. For hidden text that can carry these instructions, see ASCII smuggling.

Next step: run the canary tests against your chat interface and confirm no image loads from a domain you don't own.