Back to Intelligence

AI Agent Campaign Harvesting LLM API Keys from Exposed LiteLLM, One API, and Dify: Detection and Hardening Guide

SA
Security Arsenal Team
November 16, 2026
11 min read

Amazon's threat intelligence team has uncovered something that should get every defender's attention: attackers are deploying AI agents that autonomously hunt for weaknesses in internet-exposed AI applications — specifically LiteLLM, One API, Dify, and similar platforms — with the goal of stealing the LLM provider API keys stored inside them. The most striking detail isn't the targets; it's the economics. The attackers' own operational records, captured by Amazon using decoy servers (honeypots), show that stolen keys are being used to run the very AI models that power the search for more keys. The campaign is, quite literally, self-funding.

This is a meaningful escalation. We've watched credential harvesting shift from manual spray-and-pray to scripted botnets over the past decade. Now we're watching the loop close: AI-driven reconnaissance, AI-driven exploitation, and stolen AI compute paying for the next round. If your organization exposes an LLM gateway, proxy, or orchestration platform to the internet — and an alarming number do, often unintentionally via dev environments, shadow AI pilots, or misconfigured Docker deployments — you are in scope for this campaign.

Technical Analysis

Targeted Platforms

The campaign focuses on AI infrastructure that teams routinely stand up quickly and secure poorly:

  • LiteLLM — a popular open-source LLM proxy/gateway that centralizes access to OpenAI, Anthropic, Azure, and dozens of other providers. By design, it stores provider API keys server-side and exposes them through administrative and proxy endpoints. Default port: 4000.
  • One API — an open-source LLM API management and redistribution layer, widely deployed in Chinese and international dev communities. Default port: 3000. It aggregates provider credentials and often runs with weak default admin credentials (root/123456 in older default configs).
  • Dify — an open-source LLM application development platform. Default ports: 80/5001. Dify stores provider keys in its backend database and has historically shipped with dangerous defaults, including a well-known weak default SECRET_KEY (sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U) in its Docker configuration that enables session forgery and account takeover if left unchanged.

No CVE identifiers were published with Amazon's disclosure. The exploitation pattern described is consistent with configuration exploitation and exposed-management-interface abuse rather than a single patched software flaw — which is exactly why patching alone won't save you here.

Attack Chain

Based on the records Amazon's decoy servers captured, the operational flow looks like this:

  1. Discovery: AI agents conduct broad internet scanning for the default ports, HTTP fingerprints, and login pages of LiteLLM, One API, Dify, and similar AI middleware. Shodan/Censys-style reconnaissance, but executed and triaged autonomously by an agent rather than a human operator.
  2. Access: The agents probe for unauthenticated administrative endpoints, default credentials, weak or unchanged secret keys, and known misconfigurations in each platform. LiteLLM's /key/list, /model/info, and virtual key management endpoints are high-value targets when the master key is unset or leaked.
  3. Key extraction: Provider API keys (OpenAI sk-..., Anthropic sk-ant-..., AWS Bedrock credentials, Azure OpenAI keys) are pulled from the application's configuration store, database, or admin API.
  4. Monetization / recursion: Stolen keys are used to run LLM inference — including the inference that powers the agents' own continued scanning and exploitation. Fraudulent usage also lands on the victim's provider bill, sometimes reaching five or six figures before detection.

Exploitation Status

This is confirmed active, in-the-wild exploitation — not theoretical. Amazon's threat intelligence team captured the agents' own task records via honeypot infrastructure, meaning the campaign is operational, scaled, and generating real stolen-key telemetry. There is no CISA KEV entry associated with this disclosure, and defenders should not wait for one: the exposure vector is misconfiguration and internet exposure, not an unpatched binary.

Why This Matters Beyond Key Theft

Stolen LLM keys are not like stolen FTP passwords. The blast radius includes:

  • Direct financial loss from fraudulent inference billed to your provider account.
  • Data exposure — LiteLLM and Dify deployments routinely log prompts and completions, which may contain customer PII, source code, or internal documents.
  • Lateral movement — provider keys often sit alongside cloud credentials (Bedrock IAM keys, Azure OpenAI endpoints) that unlock broader cloud access.
  • Attribution laundering — attackers running their operations through your keys make malicious activity look like yours.

Detection & Response

The detections below target the behaviors Amazon described: scanning/fingerprinting of LLM middleware, administrative endpoint abuse, key enumeration, and anomalous outbound API consumption.

YAML
---
title: LiteLLM Administrative Key Enumeration from External Source
id: 3f7a9c21-8b4d-4e6f-9a12-7c5d8e2f1a34
status: experimental
description: Detects requests to LiteLLM administrative key management endpoints, which are targeted by AI agent campaigns harvesting LLM provider API keys from exposed LiteLLM gateways.
references:
  - https://thehackernews.com/2026/11/amazon-uncovers-ai-agent-campaign.html
author: Security Arsenal
date: 2026/11/15
tags:
  - attack.discovery
  - attack.credential_access
  - attack.t1552.001
logsource:
  category: webserver
  product: generic
  service: litellm
detection:
  selection:
    cs-uri|contains:
      - '/key/list'
      - '/key/info'
      - '/key/generate'
      - '/user/list'
      - '/model/info'
      - '/global/config'
  condition: selection
falsepositives:
  - Internal platform administration from known admin subnets — restrict via allowlist tuning
level: high
---
title: Dify or One API Admin Authentication Anomaly
id: 8e2b4d67-1a3f-4c59-b7e2-9d6f0a4b8c15
status: experimental
description: Detects authentication attempts against Dify and One API administrative login endpoints from external sources, consistent with automated AI agent probing for default or weak credentials.
references:
  - https://thehackernews.com/2026/11/amazon-uncovers-ai-agent-campaign.html
author: Security Arsenal
date: 2026/11/15
tags:
  - attack.initial_access
  - attack.t1078
  - attack.t1110
logsource:
  category: webserver
  product: generic
detection:
  selection_dify:
    cs-uri|contains:
      - '/console/api/login'
      - '/console/api/setup'
      - '/v1/api-keys'
  selection_oneapi:
    cs-uri|contains:
      - '/api/user/login'
      - '/api/token/'
      - '/api/channel/'
  filter_internal:
    c-ip|startswith:
      - '10.'
      - '172.16.'
      - '192.168.'
  condition: 1 of selection_* and not filter_internal
falsepositives:
  - Legitimate remote administration over VPN with non-RFC1918 source IPs
level: high
---
title: LLM Proxy Process Spawning Shell or Network Reconnaissance Tools
id: 5c1d8e42-6f3a-4b78-9e21-4a7c3d5f6b02
status: experimental
description: Detects LiteLLM, Dify, or One API processes spawning shells, curl/wget, or Python interpreters — a strong post-compromise indicator when an AI application is abused to pivot or exfiltrate harvested keys.
references:
  - https://thehackernews.com/2026/11/amazon-uncovers-ai-agent-campaign.html
author: Security Arsenal
date: 2026/11/15
tags:
  - attack.execution
  - attack.t1059
  - attack.exfiltration
logsource:
  category: process_creation
  product: linux
detection:
  selection_parent:
    ParentCommandLine|contains:
      - 'litellm'
      - 'dify'
      - 'one-api'
      - 'one_api'
      - 'gunicorn'
      - 'uvicorn'
  selection_child:
    Image|endswith:
      - '/sh'
      - '/bash'
      - '/curl'
      - '/wget'
      - '/nc'
      - '/ncat'
      - '/python'
      - '/python3'
  condition: all of selection_*
falsepositives:
  - Dify Celery workers legitimately invoking Python — tune against worker container hostnames
level: high

The KQL query below assumes you're ingesting firewall, WAF, or reverse-proxy logs into Sentinel (via CommonSecurityLog or Syslog), plus Defender for Endpoint telemetry for hosts running AI middleware. It hunts for external sources touching LLM platform administrative surfaces and correlates with outbound key exfiltration patterns.

KQL — Microsoft Sentinel / Defender
// Hunt: external probing of LLM middleware admin surfaces (LiteLLM, Dify, One API)
let AdminPaths = dynamic([
  "/key/list", "/key/generate", "/global/config",       // LiteLLM
  "/console/api/login", "/console/api/setup",           // Dify
  "/api/token/", "/api/channel/", "/api/user/login"   // One API
]);
union isfuzzy=true
  (CommonSecurityLog
   | where RequestURL has_any (AdminPaths)
   | where not(ipv4_is_private(SourceIP))
   | project TimeGenerated, SourceIP, RequestURL, RequestMethod, DeviceVendor, DestinationIP),
  (Syslog
   | where SyslogMessage has_any (AdminPaths)
   | project TimeGenerated, Computer, SyslogMessage)
| summarize Requests = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated)
  by SourceIP, RequestURL
| where Requests > 3 or RequestURL has_any ("/key/list", "/global/config", "/api/token/")
| sort by Requests desc
KQL — Microsoft Sentinel / Defender
// Hunt: processes on LLM-app hosts making outbound connections to paste/exfil or non-provider endpoints
let LLMHosts = (DeviceProcessEvents
  | where ProcessCommandLine has_any ("litellm", "dify", "one-api")
  | summarize by DeviceName);
DeviceNetworkEvents
| where DeviceName in (LLMHosts)
| where not(RemoteUrl has_any ("api.openai.com", "api.anthropic.com", "openai.azure.com", "amazonaws.com", "generativelanguage.googleapis.com"))
| where RemoteIPType == "Public"
| summarize Connections = count(), FirstSeen = min(TimeStamp) by DeviceName, RemoteUrl, RemoteIP, RemotePort
| sort by Connections desc
VQL — Velociraptor
-- Velociraptor hunt: identify LLM middleware processes and their network exposure
-- Targets LiteLLM, Dify, and One API processes plus listeners on default ports
SELECT Pid, Name, CommandLine, Exe, Username, CreateTime
FROM pslist()
WHERE CommandLine =~ '(?i)litellm|dify|one[-_]api'
   OR Exe =~ '(?i)litellm|dify|one[-_]api'

-- Correlate: which of these are listening on well-known default ports
SELECT Pid, Name, LocalAddress, LocalPort, RemoteAddress, RemotePort, State
FROM netstat()
WHERE State = 'LISTEN'
  AND LocalPort IN (4000, 3000, 5001, 80)
  AND LocalAddress IN ('0.0.0.0', '::')

The following Bash script audits a Linux host (or container host) for exposed LLM middleware, checks for dangerous LiteLLM/Dify defaults, and verifies provider key exposure. Run it against any host in your inventory that touches AI workloads — including forgotten dev boxes.

Bash / Shell
#!/bin/bash
# audit_llm_exposure.sh — Security Arsenal LLM gateway exposure audit
set -euo pipefail

echo "=== [1/5] Listening services on LLM middleware default ports ==="
ss -tlnp | grep -E ':(4000|3000|5001)\b' && \
  echo "[!] ALERT: LLM middleware port listening — verify it is bound to localhost or behind an authenticated reverse proxy" \
  || echo "[+] No LLM middleware default ports listening"

echo ""
echo "=== [2/5] LLM-related containers running ==="
docker ps --format '{{.Names}} {{.Image}} {{.Ports}}' 2>/dev/null | \
  grep -iE 'litellm|dify|one[-]?api' && \
  echo "[!] ALERT: Inspect port mappings above — any 0.0.0.0 binding means internet/LAN exposure" \
  || echo "[+] No LLM containers detected"

echo ""
echo "=== [3/5] Dify dangerous default SECRET_KEY check ==="
grep -rIl "sk-9f73s3ljTXVcMT3Blb3ljTqtsKiGHXVcMT3BlbkFJLK7U" /opt /srv /home /root 2>/dev/null && \
  echo "[!] CRITICAL: Dify default SECRET_KEY in use — session forgery possible. Rotate immediately." \
  || echo "[+] Dify default SECRET_KEY not found on disk"

echo ""
echo "=== [4/5] LiteLLM master key hygiene ==="
grep -rIE "LITELLM_MASTER_KEY=(sk-1234|\"\"|'')" /opt /srv /home /root /etc 2>/dev/null && \
  echo "[!] CRITICAL: LiteLLM default/empty master key found — admin API is effectively unauthenticated" \
  || echo "[+] No default LiteLLM master key detected"

echo ""
echo "=== [5/5] Provider API keys present in environment/files (rotation candidates) ==="
grep -rIlE "sk-(ant-)?[a-zA-Z0-9_-]{20,}" /opt /srv /home /root --include='*.env' --include='*.yaml' --include='*.yml' 2>/dev/null | head -20

echo ""
echo "Audit complete. Any ALERT/CRITICAL finding requires immediate remediation and key rotation."

Remediation

There is no patch to apply here — the fix is architectural and operational. Prioritize in this order:

  1. Inventory and de-expose (today): Enumerate every LiteLLM, Dify, One API, or similar deployment in your environment — including shadow AI pilots. Nothing in this class of software should be directly internet-reachable. Bind to localhost or a private interface and place behind an authenticated reverse proxy (mTLS or SSO-fronted). Check your cloud security groups and any 0.0.0.0 Docker port bindings.
  2. Rotate all provider keys (today, if any exposure is found): Rotate every OpenAI, Anthropic, Azure OpenAI, and Bedrock credential that has ever lived in an exposed instance. Assume compromise. Review provider billing dashboards for anomalous inference spend over the last 90 days.
  3. Fix dangerous defaults:
    • Dify: Replace the default SECRET_KEY in your Docker docker-compose.yaml/.env with a strong random value, and invalidate all existing sessions. Review official hardening guidance at the Dify GitHub repository (github.com/langgenius/dify).
    • LiteLLM: Set a strong, unique LITELLM_MASTER_KEY; never deploy with the documented example value sk-1234. Disable unauthenticated access to /key/* and /global/config routes. See docs.litellm.ai for the proxy's virtual-key and auth configuration.
    • One API: Change the default root account password immediately; enforce strong session secrets.
  4. Enforce egress controls: LLM gateways should only be able to reach legitimate provider endpoints (api.openai.com, api.anthropic.com, *.openai.azure.com, Bedrock endpoints). Deny-all egress otherwise. This breaks the exfiltration and recursion loop even if a gateway is compromised.
  5. Implement provider-side guardrails: Set hard spend caps and rate limits on every provider key, enable per-key usage alerting, and scope keys to minimum-required models and permissions. Treat LLM API keys with the same rotation and vaulting discipline as cloud IAM credentials — store them in a secrets manager, never in container env files on disk.
  6. Monitor the loop: The defining characteristic of this campaign is autonomous recursion. Alert on anomalous inference volume (token throughput, off-hours spikes, unfamiliar model invocations) — that is both your compromise indicator and your fraud detector.

The Bigger Picture

Amazon's honeypot findings mark an inflection point: autonomous agentic tooling has crossed from attacker experimentation into production-scale, self-sustaining operations. The defensive lesson is not novel — don't expose admin surfaces, don't keep default secrets, monitor your egress — but the adversary's speed and scale have changed. A misconfigured LiteLLM instance that would have taken a human-operated botnet weeks to find is now discovered and drained in hours by an agent that pays for its own compute with your stolen keys.

If you run any AI middleware, assume it is being scanned right now. Verify exposure, rotate keys, and instrument detection before the agents find you first.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.