What Amazon's Threat Intelligence Team Found
In late 2026, Amazon's security researchers discovered that attackers had deployed machine learning agents to systematically scan the internet for exposed instances of AI application frameworks. The researchers identified the campaign by setting up decoy servers designed to mimic vulnerable deployments of popular tools like LiteLLM (a gateway for language models), Dify (a low-code AI application platform), and One API (an API aggregator). When the attackers' agents attempted to probe these honeypots, Amazon captured detailed logs showing the attacker infrastructure, techniques, and objectives.
The records revealed something unusual: the attackers were not just collecting keys manually. They had created a self-sustaining loop in which stolen credentials were immediately weaponized to fund the next phase of the campaign. Compromised API keys were used to call AI models, and the results of those model calls powered the agents' next targeting queries, effectively turning victim infrastructure into a resource for the attack itself.
How the Attack Cycle Works
The campaign demonstrates a form of credential arbitrage. An attacker scans for exposed applications using automated probes or vulnerability scanners. When a weak instance is found (often running with default credentials, misconfigured cloud storage, or unpatched software), the attacker extracts the stored API keys. These keys grant access to commercial AI services such as OpenAI's GPT, Anthropic's Claude, or other LLM providers.
The attacker then uses those keys to run AI inference calls at the victim's expense. The output of those calls informs the attacker's own AI agent about where to look next: how to refine search queries, what endpoint patterns to target, which repositories on GitHub might contain similar keys, or how to craft more convincing phishing messages. This creates an economic incentive to keep the loop running, since each successful theft pays for the next reconnaissance step.
Why LiteLLM, Dify, and Similar Tools Are Targets
LiteLLM and Dify are popular because they abstract away the complexity of working with multiple AI providers. Developers use them to route requests between different language models, manage rate limits, and log usage. However, this convenience means the applications must store API keys locally, often in configuration files, environment variables, or databases. If a developer deploys these tools on a public-facing server without authentication, or if the deployment inherits credentials from a shared cloud account, those keys become accessible.
One API faces similar risks. These applications are attractive targets because a single compromised instance exposes keys that unlock expensive, high-quota APIs. An attacker with access to a corporate account's Claude or GPT API key can generate thousands of inferences before the key is revoked, burning through the victim's budget and making it harder to detect the intrusion among legitimate traffic.
What Makes This Campaign Different From Previous Attacks
Traditional API key theft has relied on human attackers browsing GitHub for accidentally committed credentials, or social engineering developers to reveal keys. This campaign is notable because it is fully automated and self-learning. The AI agents adjust their scanning strategy based on real-time feedback from previous searches. They can probe thousands of applications daily without human oversight, and they operate at a speed that makes manual incident response difficult.
The use of captured infrastructure to fund the attack also represents a cost-shifting tactic. By stealing keys and immediately using them, attackers avoid the upfront expense of running large-scale reconnaissance from their own infrastructure. The victim pays for both the stolen API quota and, indirectly, the attack against other victims.
Reality Check: How Exposure Actually Happens
According to public incident data from security vendors and cloud provider notifications, exposed API keys typically result from one of three scenarios. First, a developer commits a key to a public GitHub repository or similar version control system and does not notice before it is indexed by search engines or scraped by attackers. Second, a deployed application has debug endpoints or verbose error messages that leak configuration data. Third, a web application leaves API keys in environment variables or configuration files that are accessible via directory traversal or misconfigured cloud storage (such as an S3 bucket with public read permissions).
None of these require a sophisticated zero-day exploit. They stem from misunderstanding the blast radius of API credentials: treating a key as a password rather than as a capability that grants direct access to expensive services and potentially to other parts of your infrastructure.
How Developers Can Reduce Exposure
If you run LiteLLM, Dify, One API or similar tools, the following steps reduce your risk of becoming part of this attack cycle.
- Run these applications behind a firewall or private network, not directly on the public internet. Use a reverse proxy (nginx, Caddy) with authentication in front of any web-facing instance.
- Store API keys in a dedicated secrets management system (AWS Secrets Manager, HashiCorp Vault, or Kubernetes secrets), not in configuration files or environment variables.
- Rotate API keys regularly (every 30 to 90 days) and use API key monitoring services that alert you when a key appears in public repositories or attack traffic.
- Enable audit logging on your AI provider account so you can detect unexpected API calls. Most providers (OpenAI, Anthropic, AWS Bedrock) offer this natively.
- Use separate API keys for different environments (development, staging, production) and enforce the minimum necessary quota and permissions per key.
- Monitor your API provider's billing and usage dashboards daily for spikes that could indicate unauthorized access.
Practical Takeaway for Your Workflow
The real lesson here is not about any single tool being vulnerable; it is about treating API credentials as sensitive as passwords to your production database. Many developers do not. They paste keys into Slack messages, share them in Git diffs, or leave them in deployment logs. The attacker infrastructure Amazon observed is automated, but the breach surface is almost entirely human error. You cannot prevent your code from being scanned by attackers, but you can ensure that if it is scanned, no keys are there to find. Start today by running a simple search of your own repositories and configuration files for patterns like "sk-", "api_key=", or the names of your API providers. If you find anything, rotate those keys immediately and move them into a secrets manager before your next deployment.
