Artificial Intelligence 5 min read 1056 words

Two million canaries to find out where our prompts go

ES
Two million canaries to find out where our prompts go

Miners took a canary down the mine because the bird noticed the gas before they did: if it stopped singing, it was time to run. In computer security the trick has been inherited under the same name: a canary is a fake but believable piece of data (a key, a URL, a password) that nobody should ever use, so if somebody does use it, you know something is wrong and, with a bit of care, where it leaked from.

Well, HD Moore, the Metasploit guy who now leads research at Dragos, has taken nearly two million canaries down the AI API mine, and what he found won’t reassure anybody.

The experiment

Between July and November, his team sent nearly two million prompts to AI providers, and into each one they put unique secrets: AWS access keys pointing to empty accounts with full logging enabled, SSH passwords, unique URLs and DNS names, and references to private git repositories. Each secret went into a single prompt sent to a single provider, so if anybody used it later, they knew exactly where it had come from.

The important context is how prompts reach a model these days. Many applications don’t talk directly to Anthropic or OpenAI, but to an AI router (OpenRouter, Vercel and the like) that picks the cheapest or most suitable provider for each request. That provider may in turn be a reseller renting capacity somewhere else, and sometimes one router hands the request to another router. The prompt is encrypted on the way, but it’s decrypted at every hop, and every hop can store it.

flowchart LR
    A["Your application"] --> B["AI router"]
    B --> C["Another router or marketplace"]
    C --> D["Reseller"]
    D --> E["Inference provider"]
    E --> F["Model"]

To find out which way each request went, they sent deliberately malformed requests: each router wraps the errors from the ones behind it in its own format, and in a single response they could see three or four layers. That’s how they traced some 2,000 routes.

What they found

WhatHow
Three inference providers breachedNone of them knew until Dragos told them; the oldest since mid-July
Keys stolen at the front doorIn the worst case every request from certain windows was stolen, even those the provider rejected before reaching the model
Resellers reading promptsThey turned on request logging, a normal option on their marketplace, and then used what they found
Scrapers visiting URLsA Chinese lab opened the secret URLs from more than half of the prompts, including two thirds of those marked as “no data retention”
Data shared by handA secret link ended up pasted in a company chat 24 days later, and was opened from six devices in two minutes

The breached providers are the most serious part. The attackers tested the AWS keys sometimes within hours of them being sent, went through S3 buckets and secrets managers looking for more credentials, tried to enable models in Bedrock and created IAM users to stay in. In total, tens of thousands of AWS API calls with keys that had only ever existed inside a prompt. In the other two cases, some of the stolen requests were flagged as Zero Data Retention, and Moore sums it up very well: “a privacy flag doesn’t help when the attacker is already inside”.

The resellers part is even a bit shabby: in one case, someone on a home connection in France copied passwords from two prompts by hand and tried to log in over SSH as root, four times in two minutes. And they detected it by sending the same prompt to the same model through different sellers: if the key was only used when it went through one of them, the culprit was the seller, not the model.

And the Chinese lab has an extra twist: several US providers resell its models, and prompts sent through them triggered the same scraper. Whoever picked a US provider precisely so their data would stay there didn’t get what they paid for. The big home players aren’t off the hook either: a major US provider kept visiting a secret URL more than two months after a single call to its search endpoint.

Dragos doesn’t name the providers involved, but according to Ars Technica, OpenRouter has already written to its customers warning that some prompts sent to MiniMax models (directly or through three other resellers) may have been read, and has removed the “zero data retention” label from those endpoints.

What’s on us

This is where it hits close to home. A couple of weeks ago I wrote about how Claude Code stored secrets in a file that ended up on GitHub, and Moore’s conclusion goes along the same lines: agents send everything they can read, credentials included. If your agent has access to a .env, that .env can end up in a prompt, and that prompt can go through four companies before reaching the model.

His recommendations, from safest to least safe:

  1. Host the models yourself, if you can afford it. It’s the only option where nobody else reads the prompts, and it isn’t cheap.
  2. Go directly to a first-tier provider, with one contract and one privacy policy to read, instead of a chain of them.
  3. If you use a router, pick the providers behind it yourself instead of accepting the default pool, check that the privacy options really change the route, and stay away from reseller marketplaces (some only accept cryptocurrency, and part of their capacity comes from stolen keys).
  4. Plant your own canaries: put fake credentials in the context your agents send and treat any use as an incident. With a free Canarytoken from Thinkst you can start today.
  5. Enable secret filtering where the provider offers it, knowing that it only catches what looks like a key.

The line I’m keeping is another one from Moore himself: “where your prompts go is a decision, and if you don’t make it, the lowest price will make it for you”. The cheapest router is very tempting when you’re trying things out, but a prompt isn’t just a question: it’s all the context you’ve given it, and with agents that context keeps getting bigger. So my list for this week is pretty short: review what my agents have within reach, which providers each thing talks to, and plant the odd canary.