AI agents are now hunting for leaked API keys: how to protect your business
In November 2026, Microsoft, Amazon and security firms reported attackers using AI agents to find and use leaked API keys in minutes. Here is what happened and a practical checklist to protect your apps and AI tools.
AI agents are now hunting for leaked API keys: how to protect your business
Short answer: attackers are now pointing AI agents at the internet to find leaked API keys, test them, and use them, all within minutes and with no human typing commands. If a key to your cloud, payment, email or AI provider is sitting in a public repository, a front-end bundle, or an unprotected admin panel, assume it will be found quickly. The fix is not exotic: keep secrets out of code, give every key the smallest possible permissions, put spend limits on AI keys, lock down admin panels, and rotate a key the moment it is exposed.
What happened in November 2026?
Three separate reports this month showed the same pattern: AI agents doing the slow, boring part of an attack (searching, testing, retrying) at machine speed.
- GitHub to Azure Key Vault in five minutes. Microsoft Threat Intelligence described attackers using an open-source agent framework called ARTEX to search public GitHub for application secrets and cloud credentials. In one documented case the agent went from a GitHub search to pulling data out of Azure Key Vault in about five minutes. It did not exploit a software bug. It simply signed in with a leaked secret and explored everything that secret was allowed to reach (Truffle Security’s summary).
- Agents stealing AI keys to pay for more attacks. Amazon’s decoy network recorded agents hunting for exposed AI gateways and app builders, such as LiteLLM, Dify, Langflow and Open WebUI, to steal the AI provider keys stored inside. According to the Cloud Security Alliance’s analysis, the stolen keys were then used to pay for the AI that powered further key hunting.
- A coding agent probing a financial firm. Security startup Jesta reported that someone used the open-source coding agent OpenCode against a financial services company. The agent read API documentation, followed a link, and tried a planted key within 5 minutes 44 seconds. The key was a decoy, so nothing was taken (The Register).
Why does this matter for a small or mid-sized business?
Until recently, a leaked key in an old repository might sit unnoticed for weeks. Agents change the economics: they are cheap to run, they do not get bored, and they fix their own mistakes. In the Microsoft case, the agent corrected failed requests within about half a minute and carried on.
Most businesses now hold several keys that are worth stealing:
| Key | What an attacker can do with it |
|---|---|
| Cloud (AWS, Azure, Google Cloud) | Read databases and storage, run servers on your bill |
| AI provider (OpenAI, Anthropic, Google) | Run up large usage charges, use your account for abuse |
| Payment (Stripe and similar) | See customers and transactions, issue refunds |
| Email and SMS (Resend, SendGrid, Twilio) | Send phishing from your domain or number |
| CRM and marketing tools | Export your leads and customer list |
Where do keys usually leak?
- Public or once-public Git repositories, including old commits. Deleting a file does not remove it from Git history.
- Front-end code. Anything shipped to the browser is public. Variables such as
NEXT_PUBLIC_in Next.js orVITE_in Vite end up in the bundle. - Self-hosted AI tools left open, such as an AI gateway, chatbot builder or workflow tool with a default admin password or no login at all.
- Automation tools (n8n, Make, Zapier) where credentials are shared broadly or exported in workflow files.
- Screenshots, support tickets, and chat messages where someone pasted a key to “quickly test something”.
How do you protect your business? A practical checklist
- Keep secrets out of code. Store them in environment variables or a secrets manager, never in the repository, and add
.envto.gitignorefrom day one. - Scan for leaks automatically. Turn on GitHub secret scanning and push protection, or run a scanner such as TruffleHog or Gitleaks in your pipeline, so a key is blocked before it is pushed.
- Give every key the least access it needs. A key that only sends email should not be able to read your database. Use separate keys for development and production.
- Put limits on AI keys. Set monthly spend caps and rate limits with your AI provider, and turn on billing alerts. A stolen key with a cap costs you hours, not thousands.
- Lock down admin panels and AI tools. Change default passwords, require login on every management page, and keep tools like n8n, LiteLLM or Open WebUI behind a VPN, an access proxy, or at least an IP allowlist.
- Rotate immediately when a key is exposed. Do not wait for a scheduled rotation. Revoke it, issue a new one, then check what the old key could reach and whether anything new was created while it was exposed.
- Watch for unusual behaviour. Alerts on new sign-ins, sudden usage spikes, or requests from unexpected countries catch most abuse early. As Jesta pointed out, the address used in their incident was not on any blocklist. The behaviour gave it away.
What if your business is building its own AI agents?
The same lesson applies in reverse. An agent you build to handle leads, support or operations holds keys too, and it should be governed like a new employee with system access:
- Give each agent its own identity and keys, scoped to the systems it actually needs.
- Decide what it may do on its own and what needs approval. Reading data and drafting replies can be automatic. Sending money, deleting records or emailing customers in bulk should wait for a human.
- Log every action the agent takes, with its inputs, so you can review and undo mistakes.
- Never put secrets in prompts or instructions. The agent should call tools that hold the credentials, not see the keys itself.
- Start narrow and widen permissions only as the results prove reliable.
How Veltrivo helps
Veltrivo builds AI agents and automations with these controls in place from the start: secrets kept out of code, scoped keys, spend limits, approval steps for risky actions, and full logs. We can also review an existing app or automation setup for exposed keys and open admin panels. See our AI automation service and custom software and API development, read what AI automation looks like for small businesses, or tell us about your project.