Dev.to Security 🔐 Cybersecurity 👁 0 📖 5 min read

Exposed API Keys: How AI Agents Now Hunt Them on Websites and AI Apps

Exposed API keys used to be found by a person running a search, or by a bot scraping GitHub. In November 2026, Amazon’s threat intelligence team showed what that looks like when the searcher is an AI agent that never get

Exposed API keys used to be found by a person running a search, or by a bot scraping GitHub. In November 2026, Amazon’s threat intelligence team showed what that looks like when the searcher is an AI agent that never gets tired. Its decoy servers captured the working records of attacker agents that hunted internet-exposed AI apps, pulled out the provider keys stored inside, tested them, and added the working ones to a shared pool. The stolen keys then paid for the AI models that ran the next round of searching.

If your website or web app uses an AI provider, a payment API, a maps API or a cloud account, this is about you, even if you have never heard of LiteLLM or Dify.

What Amazon found

Amazon runs a network of decoy sensors called MadPot. Between 3 October and 5 November 2026, some of those decoys were set up to look like popular large language model (LLM) APIs. AI agents connected to them and sent requests that carried their own campaign history: operator instructions, task lists and reported findings.

Amazon assessed with moderate confidence that the agents ran on ARTEX, an open-source AI penetration-testing framework, and that the operators were separate China-linked groups. It also said clearly that it could not verify the outcomes the agents reported. What the records do show is what the attackers were going after, and how.

The targets

The main campaign focused on apps that hold keys for many AI providers at once, because one weak admin page there can expose many accounts. Amazon names:

  • LLM gateways and proxies: One API, New API, Veloera, Sub2API and LiteLLM.
  • AI app builders: Dify, FastGPT, Langflow, RAGFlow, Open WebUI, LobeChat and Ollama.

The playbook

The agents carried a list of known entry points for each product:

  • installs that were never finished, which an outsider could claim;
  • management and provider-settings pages that need no login;
  • default administrator credentials, such as LiteLLM’s default master key;
  • known flaws, including Langflow CVE-2025-3248 and RAGFlow CVE-2026-28797;
  • an authentication bypass through the isCliRequest header in One API family systems;
  • server-side request forgery (SSRF) through URL-fetch features, used to reach cloud metadata services;
  • secrets left in client-side JavaScript, source maps, debug routes and environment files.

To find leaked keys elsewhere, the agents used internet scanning services, certificate transparency logs, GitHub repositories, npm and PyPI packages, container images, notebooks, paste sites and Telegram channels.

Who is affected

Anyone who self-hosts one of the named AI apps on the open internet is the obvious group. But the last item on the playbook is the one most website owners should read twice. Keys in front-end JavaScript, in a public .map file, in a debug page or in a reachable .env file are not an AI-app problem. They are a website problem, and they are common.

We covered a related case in our post on rotating API tokens after the Apify breach: once a key is out, the only fix is to replace it.

Where keys leak on an ordinary website

  • The JavaScript bundle. Anything sent to the browser is public. A provider key called straight from the front end can be copied by anyone who opens developer tools.
  • Source maps. A deployed .map file can rebuild your original source, comments and config included.
  • Debug and error pages. Verbose errors and debug routes often print environment values. See WordPress debugging without exposing error logs to the public.
  • Environment files in the web root. A .env or config backup that the server will hand out on request.
  • URL-fetch features. An “import from URL” or webhook feature can be abused to reach cloud metadata and the credentials behind it. Our SSRF prevention guide explains the controls.

A website vulnerability scanner that looks from the outside can help you spot a public .env file or a debug page. It will not see keys that already sit in a private repository, a container image or a chat channel.

How stolen keys get sold

Keys like these are rarely used only by the person who found them. In Amazon’s records the keys went into a shared pool, and the agents graded each credential by whether it worked and what it could reach. On underground markets and Telegram channels, working AI and cloud keys are traded the same way: tested, labelled by provider and spending limit, and resold. The victim usually finds out from the bill.

Start with a look at your own site. You can check your website for vulnerabilities from the outside, then search the shipped JavaScript and common paths such as /.env yourself.

What to check this week

  1. Search your public site for secrets. Look at the shipped JavaScript, any .map files and common paths such as /.env. If a key is there, move the call to your backend and rotate the key.
  2. Change default credentials. Any admin panel, gateway or master key that still uses the install default should be changed today.
  3. Finish or remove half-done installs. A setup wizard left open on a public server can be claimed by anyone.
  4. Patch the named flaws. Langflow 1.3.0 fixes CVE-2025-3248, which CISA lists as actively exploited. For RAGFlow, NVD lists 0.24.0 and earlier as affected by CVE-2026-28797.
  5. Turn on spending alerts for every AI and cloud provider, and give API tokens an expiry date and IP limits where the provider allows it.

Amazon’s own summary is the right mindset: “None of the techniques in these campaigns were new. What AI agents change is the speed and persistence of the attacker.” If you want an outside view of what your site exposes, you can run a free website security scan on a site you own.

FAQ

What are exposed API keys?

Exposed API keys are credentials for a service, such as an AI provider, payment gateway or cloud account, that someone outside your team can read. Common places are front-end code, source maps, debug pages, public repositories and reachable .env files.

I don’t run LiteLLM or Dify. Should I care?

Yes. The same agents looked for keys in ordinary website files: client-side JavaScript, source maps, debug routes and environment files. Any site that talks to a paid API can leak a key that way.

What should I do if I find a key in my site’s code?

Treat it as stolen. Create a new key, update your server to use it, delete the old one, and check the provider’s usage and billing for activity you don’t recognise. Then move the call to your backend so the new key never reaches the browser.

Sources: Amazon Threat Intelligence (AWS Security Blog), The Hacker News, and CISA KEV catalog.

The original version of this article is on the HackerMe Security blog.

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.