Signals/ Safety & Policy/ Reel /
Microsoft Agent Framework: Two Poisoned Python Versions Steal Your Keys
Two fake releases of Microsoft's Agent Framework for Python stole keys the moment Python started. Here's the 3-step check, and a prompt that does the searching for you.
If you build AI agents in Python, check this today. On November 17, two versions of Microsoft’s agent-framework package, 1.26.1 and 1.26.2, were uploaded to PyPI without authorization. PyPI is the store Python downloads packages from. Both versions carried code that steals credentials.
How it steals
The bad versions add a small .pth file. Python reads files like that every time it starts, so the code runs as soon as Python starts in that environment, even if your app never imports the package.
According to the PyPA advisory, it collects:
- environment variables with names like TOKEN, SECRET, KEY, AZURE, AWS, GITHUB and OPENAI
- login files such as
.git-credentials,.netrc,.npmrc,pip.conf, Docker config and.envfiles - cloud identity tokens (Azure, and on 1.26.2 GitHub Actions tokens too)
Then it sends them to an outside web address.
Pulled from the store, but not from your computer
Both versions were removed from PyPI. Microsoft points out that this doesn’t remove copies you already downloaded: a lockfile, a pip cache, a container image or a company mirror can still hold one. Microsoft has also taken the Agent Framework repository offline until it is sure it’s safe to bring back. The project has not been discontinued.
What is not affected: version 1.26.0 and earlier, the other Agent Framework Python packages, the .NET packages and Semantic Kernel. The bad code was in the published packages, not in the repository.
Your 3-step check
- Search. Look in lockfiles,
pip freezeoutput, CI logs, container images, internal mirrors and pip caches for 1.26.1 or 1.26.2. The tell-tale files insite-packagesareagent_framework_meta.pth(1.26.1) andaf_runtime_diag.pth(1.26.2). - Found one? Change every key. Treat that machine, container or CI job as compromised. Rotate every credential it could reach: cloud identities, CI and package-registry tokens, API keys and Git logins.
- Rebuild from a clean copy. Don’t just downgrade in place. Remove the affected environments, images and caches, rebuild from a clean image, and look through cloud and CI audit logs from November 17 onward.
Never installed them? Pin agent-framework==1.26.0 (or the exact sub-packages you use) and hold there until Microsoft gives more guidance.
Let your coding agent do the searching
Paste this into Claude Code, Codex or whichever coding agent you use, inside the project you want checked:
Check this project and this computer for the bad agent-framework versions 1.26.1 and 1.26.2.
Look in lockfiles, pip freeze, the pip cache and any Docker images.
Also search site-packages for agent_framework_meta.pth and af_runtime_diag.pth.
Tell me what you find. Don't change anything.
The “don’t change anything” line matters. If it finds something, you want to rotate keys and rebuild on purpose, not have an agent quietly downgrade the package and call it fixed.
Why this matters beyond one package
AI agent projects tend to sit next to a lot of keys: model API keys, cloud logins, GitHub tokens. That makes a poisoned AI library a good target. A simple habit helps: pin exact versions in your lockfile, and let updates in on purpose instead of automatically.
The full details, including the advisory’s file hashes, are in Microsoft’s post and the PyPA advisory, linked below.
Free weekly email
Get stories like this every week
The Weekly Signal: the week's AI news in plain English, plus one thing to try. Free, one email a week.
Sources & links 2
More on AI Safety & Regulation News