Microsoft's AI agent package compromised on PyPI: what companies building AI should check

Two versions of Microsoft's Python package agent-framework, used to build AI agents, were published on the PyPI registry on 17 November 2026 with added code that steals credentials. According to an analysis by security firm Wiz, version 1.26.1 was published at 20:35 UTC and version 1.26.2 at about 21:08, and both were no longer available by 21:30, less than an hour later.
What is known
- the malicious code ran through a
.pthfile every time Python started in that environment, even if the application never used the package; - it collected environment variables holding passwords and tokens (Azure, AWS, GitHub, OpenAI, npm and others),
.envfiles, Git and Docker settings, and Azure and GitHub Actions tokens, and sent them to an outside address; - Wiz says the attacker appears to have obtained a certificate and key for Microsoft's release publishing system, and how they got them is not yet known;
- the last clean version is 1.26.0; the total number of affected systems is unknown, and Wiz confirmed at least three cases of theft in partial data.
Why it matters
The package gets about 41,000 downloads a week and comes from a major publisher. The case shows that an official package is no guarantee: anyone who installs the latest versions automatically, on a developer laptop or in a CI system, can lose keys to cloud, code and AI services within minutes. Companies building AI agents usually keep exactly those keys in the same place.
What to do
- search lockfiles, CI logs, virtual environments and Docker images for versions 1.26.1 and 1.26.2 and go back to 1.26.0;
- if you installed them, rotate every password and token that was available in that environment and review sign-ins to Azure and GitHub accounts;
- pin exact package versions and adopt new releases a few days late, after review;
- keep production keys out of development environments and give each service only the permissions it actually needs.
We help companies adopt AI and automation with clear rules on access and keys. See AI integration and business process optimisation.