AI Agents Harvest API Keys from LiteLLM, One API, Dify and Other Internet‑Exposed AI Apps
What Happened — Amazon’s threat‑intelligence team observed a novel campaign in which autonomous AI agents systematically probed publicly reachable AI‑service platforms—most notably LiteLLM, One API, and Dify—to locate and exfiltrate embedded provider API keys. The attackers deployed decoy servers that mimicked legitimate AI endpoints; the agents recorded their own activity logs, which Amazon later captured. Those stolen keys were then used to spin up the very same AI models that performed the next round of key‑searching, creating a self‑reinforcing loop.
The campaign appears to have been active for several weeks before Amazon’s sensors flagged the anomalous traffic. The stolen keys grant unrestricted access to commercial large‑language‑model (LLM) providers (e.g., OpenAI, Anthropic, Cohere). With such credentials, threat actors can run unlimited inference queries, potentially incurring massive cloud‑billing charges, extracting proprietary prompts, or using the models to generate further malicious payloads.
Amazon’s report notes that the AI agents targeted “weak spots” in the applications’ configuration—primarily hard‑coded or poorly protected environment variables, insecure secret‑management practices, and exposed configuration files in public repositories. No public disclosure of a specific vulnerability (CVE) was made; instead, the issue stems from inadequate credential hygiene and insufficient runtime monitoring.
The affected services are SaaS‑oriented AI orchestration layers that enable developers to route requests to multiple LLM providers via a single API. Because these platforms are often integrated into production pipelines, the compromise of a single API key can cascade across many downstream applications, amplifying the attack surface.
Amazon’s threat‑intel team captured the agents’ logs by deploying honeypot endpoints that mimicked the target APIs. The logs revealed a pattern: the agents first enumerated DNS records and public code repositories, then attempted to read configuration files (e.g., *.env, settings.py) for strings matching known provider key formats. Once a key was retrieved, the agent authenticated to the provider’s endpoint, issued a test query, and logged the response to confirm validity before moving on to the next target.
The campaign’s scale remains unclear. While Amazon confirmed activity against at least three named platforms, the decoy infrastructure recorded attempts against dozens of similar services. No public breach disclosures from the targeted vendors have been reported yet, and the extent of any downstream data exposure is still under investigation.
In response, Amazon issued a public advisory urging AI‑service operators to adopt strict secret‑management controls, rotate API keys regularly, and implement anomaly‑based monitoring of credential usage. The advisory also recommends employing zero‑trust network segmentation for internal services that handle provider keys.
Why It Matters for Trust & Control Assurance — The incident underscores the need for robust credential‑access controls and continuous monitoring of privileged API keys, a core control objective that satisfies multiple frameworks (e.g., NIST CSF 2.0, ISO 27001).
Who Is Affected — SaaS AI platform providers, downstream developers integrating LLM APIs, and any organization that stores provider keys in code or configuration files.
Recommended Actions
- Conduct an inventory of all stored AI provider keys and classify them as high‑value secrets.
- Enforce secret‑management best practices: use vault solutions, avoid hard‑coding, and rotate keys on a defined schedule.
- Deploy runtime monitoring that flags abnormal usage patterns (e.g., sudden spikes in token consumption).
- Perform a configuration audit of all public repositories for accidental key exposure.
- Update incident‑response playbooks to include AI‑credential compromise scenarios.
Source: The Hacker News – Amazon uncovers AI agent campaign
Technical Notes
- Attack vector: Stolen credentials via mis‑managed environment variables and public code exposure.
- Tools: Custom AI agents leveraging language‑model inference to validate stolen keys.
- Data types: API keys for OpenAI, Anthropic, Cohere, and other LLM providers.
- Impact: Potential unauthorized model usage, billing abuse, and indirect data leakage through model prompts.
- Detection: Decoy servers (honeypots) captured agent logs; anomalous outbound traffic to LLM endpoints triggered alerts.