Skip to content
Blog

News

Microsoft: attackers now use AI agents to hunt leaked keys

On 5 November 2026, Microsoft Threat Intelligence described attackers using an agentic AI framework to search public GitHub repositories for exposed secrets, and to use what it found within minutes. The point is not that leaks are new. It is that the gap between a leaked API key and its abuse is shrinking, and old habits such as deleting the commit and hoping are not enough. This post sums up what Microsoft reported, separates what is confirmed from what is not, and gives a short list of things to do this week.

Published · 6 min read

News card about attackers using AI agents to find a leaked api key on GitHub

Key takeaways

  • Microsoft reports attackers using an AI-driven tool to search public GitHub repositories for credentials, including AI service keys.
  • In one case it describes, an agent went from finding a client secret to exfiltrating Key Vault data in five minutes.
  • A leaked API key stays usable until someone revokes or rotates it. Deleting the code does not help.
  • The fix is boring and effective: fewer keys in code, scanning on, short lifetimes, and fast rotation.

What Microsoft reported

In a blog post dated 5 November 2026, Microsoft Threat Intelligence described activity it had observed from August 2026 onwards. According to Microsoft, attackers were using an agentic AI offensive framework, which it calls ARTEX, to run large volumes of searches on public GitHub repositories. The searches often included the name of a target organisation along with keywords for secrets, cloud services or AI providers. The tool was looking for credentials, application credentials and AI inference API keys (Microsoft Security Blog).

Microsoft says follow-on activity began as early as 28 October 2026, with leaked or stolen application credentials used to sign in as service principals across dozens of applications and several tenants. Compromised credentials were used for cloud discovery, for pulling data from Key Vaults and storage accounts, and for abusing AI services.

Two details stand out. First, Microsoft describes a case where an agent went from searching GitHub for client secrets to exfiltrating data from Azure Key Vault in five minutes. Second, it says the agents adapted when things failed: after errors caused by wrong API versions, they retried with the right ones and succeeded within roughly a minute or so.

What we can and cannot say

This is one vendor's report on activity it observed in its own telemetry. It does not give the number of victims or total losses, and we have not seen independent confirmation of the specifics. What is solid is the general direction: secrets in public code are being searched for at scale, and automation shortens the time between a leak and misuse.

That fits the wider picture. GitGuardian's 2026 report counted about 28.65 million new hardcoded secrets in public GitHub commits in 2025, up 34% year on year (GitGuardian). There is a lot to find.

Why this changes the advice

For years the comforting story was that a leaked key might sit unnoticed for weeks. If attackers can run thousands of searches and try what they find without a human in the loop, that comfort goes. Three habits that used to be borderline are now plainly risky:

  • Deleting the commit and carrying on. Microsoft's mitigation advice treats exposed credentials as compromised even after the code is deleted, because they stay usable until revoked or rotated.
  • Long-lived keys. A key that never expires is a key that a search from last year can still use.
  • Broad keys. If a leaked key can do everything, the attacker's first call does everything.

What to do this week

  1. Turn on GitHub secret scanning and push protection, or the equivalent in your code host, for every repository, including old ones.
  2. Search your history. Check old branches and forks as well as the main branch.
  3. Rotate API keys and any other credentials that may have been exposed. Revoke first, investigate after. See OWASP's advice on rotation and short-lived secrets (OWASP).
  4. Shorten lifetimes. Where a service lets you set a maximum age for a secret, set one.
  5. Narrow scopes. Give each key only the actions it needs.
  6. Keep keys out of code. Use your platform's secret settings and read them at run time.

How defenders can spot this kind of activity

Microsoft points out that attackers can change their network addresses and user agent strings, so blocking a list of addresses will not hold for long. Its advice is to watch behaviour instead. Two patterns it highlights are one address signing in to many different application identities, and one application asking for tokens across several resources in a short window. For a small team with no security staff, the simpler version is this: switch on the audit logs your cloud and code services already offer, and read the sign-in log once a week. Unfamiliar locations, unfamiliar apps and bursts of failed attempts followed by a success are the signs worth a second look. A failure followed by a success is the one to treat as urgent.

What Microsoft recommends

AreaWhat Microsoft suggestsPlain-English version
ContainmentRevoke sessions, remove affected secrets, rotate Key Vault contentsCut off access, then change everything it could reach
DetectionReview sign-in and audit logs, look for one address using many identitiesCheck who has been logging in as your apps
PreventionSecret scanning, push protection, keep secrets out of codeStop keys reaching the repository
HardeningManaged identities, secret lifetimes, least privilegeFewer, shorter, narrower keys
DeceptionDecoy credentials and honeypotsPlant fake keys that raise an alarm when used
Microsoft's mitigation advice, summarised from its 5 November 2026 post. The decoy idea is aimed at larger teams.

A scenario to make it concrete

This is an illustrative example. Two years ago a small online shop's developer pushed a payment-provider key to a public repository by mistake. She noticed within the hour, deleted the file and pushed again. She did not rotate the key, because nothing seemed to happen.

Under the old assumption, that was a calculated risk. Under the new one, the key is sitting in the repository's history, where a search tool can read it, and the shop has been exposed ever since. If she checks history today and rotates the key, the exposure ends. If she does not, the next search might find it.

Where SecretPigeon fits, and where it does not

We should be plain. SecretPigeon does not scan your repositories. Use your code host's scanning for that. Good API key security starts upstream, and that is where we can help: fewer keys travelling through chat and tickets, and fewer keys sitting in files. Our post on sharing an API key with your team covers the handover side, and AI agent API key security covers letting software use a key without holding it. The year's wider numbers are in our data study.

Questions people ask

How fast can attackers use a leaked API key?

Microsoft describes one case where an agent went from finding a client secret on GitHub to exfiltrating Key Vault data in five minutes. Assume a key may be used soon after it becomes public.

Do I need to rotate a key if I deleted the commit?

Yes. Microsoft's guidance treats publicly exposed credentials as compromised even after the code is removed, because they stay valid until revoked or rotated.

What to do if an API key is leaked?

Revoke or rotate it first, then review logs for use you did not expect, then find how it leaked. Turn on secret scanning and push protection so it is caught earlier next time.

How do I check if my API key was leaked?

Search your repositories and their history for the key, and check your code host's secret scanning alerts. Also look at the provider's usage logs for calls you do not recognise.