Microsoft Agent Framework Hacked on PyPI: What to Do Now

Last updated: 18 November 2026

Attackers published two poisoned versions of Microsoft’s official Agent Framework package on PyPI on 17 November 2026, and they were built to steal cloud and developer credentials. The malicious releases, 1.26.1 and 1.26.2, were live for under an hour, but anyone who installed either one should treat it as a credential leak. This guide explains what happened, how the trick works, how to check whether you are affected, and what our own view is on the bigger lesson for teams that build AI agents.

Image: Original illustration of how the attack worked.

Microsoft Agent Framework PyPI attack at a glance

Packageagent-framework on PyPI, the meta-package for Microsoft Agent Framework, an open-source framework for building AI agents in Python
Bad versions1.26.1 and 1.26.2
Last clean version1.26.0
Published17 November 2026 at 20:35 UTC (version 1.26.1)
RemovedNo longer available by 21:30 UTC, and both versions are now quarantined on PyPI
Package popularityRoughly 190,000 downloads a month
What it stealsAzure, GitHub, AWS, Docker, npm and Hugging Face credentials, plus secrets in environment variables and .env files
Microsoft’s responseA maintainer confirmed the removal and said an investigation is under way

What happened

Researchers found that two new releases of Microsoft’s agent-framework package had been published under the legitimate Microsoft-linked PyPI publisher, not under a lookalike name. That is what makes this case different from the usual typosquatting trick, where an attacker uploads a package with a name that is one letter off.

The package still worked normally. Both bad versions kept a dependency on the genuine agent-framework-core 1.26.0 library, so applications ran as expected while the malware did its job in the background.

It is still unclear how the attacker gained permission to publish. A security firm also noticed a PyPI maintainer account created on the day of the attack, which had publishing rights for the package and five related projects. Microsoft has not yet explained how that happened.

How the attack worked, in plain language

The clever part is a small file with the extension .pth. Python reads these files in its package folder every time it starts, and some lines in them are run as code. The attackers used this to run their stealer whenever Python launched in an infected environment, including when you simply ran pip.

That means you did not have to import agent-framework for the malware to run. A completely unrelated script on the same machine could trigger it. Security teams that only watch for suspicious imports could miss this.

Researchers say the stealer collected environment variables, credential files on disk and data from other running processes where permissions allowed. It also tried to request fresh Azure tokens, not just grab saved ones. It looked like a focused credential thief, not a remote-access trojan that lets an attacker take over the machine.

What was at risk

Where Examples of secrets targeted
CloudAzure CLI data and Azure managed identity tokens, AWS credentials
CI/CDAzure DevOps agent credentials, GitHub Actions tokens
Developer toolsGit credential stores, Docker and npm configuration
AI servicesHugging Face and OpenAI keys
ApplicationsSecrets stored in .env files

Version 1.26.2 expanded the targeting of GitHub Actions. Because one stolen upload could contain several working secrets at once, security researchers advise treating any installation of either version as a credential-compromise event.

What to do if you use agent-framework

  1. Check your version. Run pip show agent-framework or search your lock files for 1.26.1 and 1.26.2. Check build servers and containers too, not just laptops.
  2. Look for the startup file. Search your Python site-packages folders for a file called agent_framework_meta.pth.
  3. If you find it, assume secrets were exposed. Rotate cloud keys, GitHub and Azure DevOps tokens, Docker, npm, Hugging Face and OpenAI keys, and anything stored in .env files on that machine.
  4. Rebuild, don’t just uninstall. Recreate the environment from a known-good image or dependency set and pin agent-framework to 1.26.0. Removing the bad versions from PyPI does not delete copies that are already installed or cached.
  5. Review logs. Look for unusual use of the keys you rotated, starting from 17 November 2026.

If you never installed or upgraded agent-framework around 17 November, you are very unlikely to be affected by this specific incident.

Our view: what this attack teaches

This section is our own analysis, based on the published security reports.

1. AI agent projects are rich targets. Agent frameworks tend to live next to cloud keys, model API keys and code repositories. A thief who lands in that environment can collect a lot in one go, which is why we expect more attacks aimed at AI developer tooling.

2. “Official publisher” no longer means “safe”. The attack came through the real project name. One useful warning sign, according to researchers, was that no matching release tag existed in Microsoft’s GitHub repository and the main branch had no malicious code. Teams with the time can compare what is on PyPI with what is in the source repository.

3. The window was short, but short is enough. The bad releases were up for less than an hour. Any build server that automatically installed the newest version during that time could have been hit. This is the strongest argument for pinning dependencies to exact versions and for waiting a few days before adopting brand-new releases.

4. This is a repeat pattern. Reports say agent-framework is the second Microsoft-related PyPI package compromised this year, after durabletask, which was hit after a PyPI token was stolen. When the same ecosystem is hit twice, the fix is better publishing controls, not just faster cleanup.

5. Our estimate. The cheapest protections are the ones most teams skip: pin versions, use short-lived credentials in CI, give build jobs the least access they need, and keep secrets out of long-lived .env files. None of this is exciting, but each one limits what a stealer like this can take.

What to watch next

  • Microsoft’s investigation, especially how the attacker got publishing access.
  • Whether PyPI adds stricter checks for releases that lack a matching source tag.
  • Whether other AI framework packages report similar startup-hook tricks.
  • A fuller list of affected organisations, if any come forward.

Frequently asked questions

Which versions of agent-framework are malicious?

Versions 1.26.1 and 1.26.2. Version 1.26.0 is the latest clean release.

Do I have to import agent-framework for the malware to run?

No. It runs through a .pth startup file whenever Python starts in the affected environment.

Is it safe now that PyPI removed the packages?

Not if you already installed one. Removal from PyPI does not remove installed or cached copies, so check and rebuild your environments.

What should I rotate if I was affected?

Any secret reachable from that machine or build job: cloud keys, Git and CI tokens, container and package registry credentials, AI service keys, and values in .env files.

Was Microsoft hacked?

Reports say the malicious releases did not come from Microsoft’s GitHub source code. How the attacker was able to publish them is still under investigation.

Sources and disclaimer

This article is based on public reports from security researchers and news outlets, including Wiz, Socket, SecurityWeek, BleepingComputer, The Hacker News and OpenSourceMalware. Details may change as the investigation continues, so check the Microsoft Agent Framework GitHub discussion for official updates. This is general information, not professional security advice. We are not affiliated with Microsoft or PyPI.

Leave a Reply

Your email address will not be published. Required fields are marked *