Amazon Exposes AI Agents Stealing API Keys from LiteLLM, Dify & More

Amazon’s threat intelligence team has uncovered a coordinated campaign in which AI agents exploited security gaps in internet-facing AI apps—such as LiteLLM, One API, Dify and others—to steal provider API keys. These agents weren’t just gathering credentials; they then used the stolen keys to power the reconnaissance and exploitation efforts themselves.

How It Worked

The agents, believed to be grounded in ARTEX (an open-source AI-based pentesting framework), hunted for weak entry points—default master keys, uninitialized installations, known bugs in tools like Langflow and RAGFlow, and improperly secured endpoints in LLM gateways. Once a valid key was extracted, it was added to a shared stash that attackers could reuse. All of this emerged from logs captured on decoy servers set up by Amazon. These decoys, part of a network called MadPot, mimic real LLM services and were instrumented to gather intelligence from ongoing campaigns.

Key Findings & Targets

The campaign’s records list dozens of targeted platforms. App builders like Langflow, RAGFlow, FastGPT, and Ollama were among them. Gateway and proxy platforms such as One API, LiteLLM, New API, Sub2API, and Veloera also showed up frequently. Exploits ranged from authentication bypasses—for example via the isCliRequest header in some One API family tools—to server-side request forgeries (SSRF) accessing metadata services, secrets exposed in JavaScript code or environment files, and debug or management endpoints with no protections. In practice, cloud credentials for AI model hosting, secret storage, and application identity services were high-priority targets.

Attackers also used traditional reconnaissance: scanning the internet for exposed apps, searching through version control systems and public repositories, mining logs, package repositories (npm, PyPI), container images, notebooks, paste sites, and even Telegram channels. Amazon says it notified potential victims among AWS customers based on these findings.

Link to Broader Threat Landscape

Cloudflare revealed involvement by these agents in multiple incidents where a static, never-expiring CI/CD API token—without IP restrictions—was compromised. The attackers used the token to create malicious Worker scripts with names matching “artex-*” or similar, conducting large volumes of API requests and probing for further access. There’s also evidence the agents attempted identity verification bypasses at crypto exchanges using deepfakes, although those efforts appear less centralized so far.

Amazon speculates the operations may be tied to groups based in China, citing Simplified Chinese in agent prompts and China time-zone settings in the captured records. Microsoft also reported similar agent-based secret hunting activity—searching for exposed credentials that facilitate AI inference—and earlier incidents involving RAGFlow and LiteLLM. Some of these earlier flaws (like CVE-2025-3248 in Langflow) already had advisory patches, but many remain vulnerable.

What You Need to Do

Defenders are urged to treat AI apps, inference endpoints, and model gateways like any critical production system. That means eliminating default credentials, completing installations fully so no unfinished setup can be hijacked, restricting tokens (especially those used in CI/CD), and always enforcing authentication. Review logs for unusual behavior or new scripts with artex naming conventions. The Amazon report and associated advisories lay out detection rules (Snort rules, etc.), known indicators like IP lists, and specific CVEs to patch or monitor.

This isn’t just a rough sketch of what could go wrong—these agents aren’t speculative. They’ve demonstrated the speed and persistence AI adds to attacks. Their work succeeds when basic security hygiene isn’t in place.

What this means: As organizations build or integrate AI systems, overlooked credentials, lax endpoint controls, and stale or default setups are now the easiest lever for attackers. While this campaign shows no new attack techniques per se, it does prove that scale and automation—via agentic tools like ARTEX—can turn old vulnerabilities into major breaches. Going forward, operators need proactive defenses: aggressive scanning, rotating secrets frequently, enforcing least privilege, and assuming any exposed secret will be exploited swiftly. When it comes to AI security, there’s no room for complacency.