All Insights

Microsoft's Agent Framework Was Poisoned on PyPI for 55 Minutes

CivSafe Team·November 21, 2026·6 min read

Monday evening at 20:35 UTC, two malicious versions of Microsoft's official agent-framework Python package were uploaded to PyPI. By 21:30 UTC, both were gone.

Fifty-five minutes.

If your CI pipeline auto-upgrades dependencies and ran between those two timestamps, it may have installed a credential stealer. The malware targets Azure credentials, Azure DevOps tokens, and GitHub Actions secrets. It runs silently in the background every time Python starts in that environment. Not every time you import the package. Every time Python starts.

That's the story. Here's what you need to check.

What Got In

This is not a typosquat. This is not a fake package pretending to be Microsoft's. The attackers compromised the actual release pipeline for Microsoft's official agent-framework package and pushed two versions: 1.26.1 and 1.26.2.

OX Security's breakdown and Wiz's technical post have the full details. The short version: the attacker appears to have compromised credentials from Microsoft's Engineering System Release Pipeline (ESRP). With those, they could push signed releases directly to PyPI under the legitimate microsoft namespace.

The malicious code installs itself through two .pth files: agent_framework_meta.pth and af_runtime_diag.pth. Python processes .pth files at startup, not at import time. That's why the compromise is easy to miss. Your AI agent keeps running normally. Your application logs show nothing. Meanwhile, every Python process that starts in that environment is quietly exfiltrating credentials.

The package has 192,534 monthly downloads on PyPI. Not everyone who downloaded either version got hit, but any install or upgrade in that 55-minute window did.

Why This Matters More for Small Orgs

There are two things about this that make it particularly dangerous for small teams.

The first is the trust signal. Standard "watch for suspicious packages" advice tells teams to be wary of unknown packages or typosquats. This was neither. The package came from Microsoft's verified PyPI account. It was signed. It looked exactly like every other legitimate release from the same maintainer. Standard supply-chain hygiene that filters for "unknown or unverified sources" would not have caught this.

The second is what credentials are actually at risk. The malware specifically targeted Azure and CI environment secrets. Small teams building with AI frameworks are increasingly running automated pipelines that have real production access. Azure keys that can spin up compute, write to storage, and deploy containers. GitHub Actions tokens with push access to your main branch. If those get out, the attacker does not need to find a clever exploit. They can just log in.

Large orgs have secrets management infrastructure, service accounts with minimal scopes, and audit trails that flag unusual credential use. Most small teams have a .env file, an AZURE_API_KEY in their CI settings, and the assumption that their vendor's official package is safe to install.

There is also a migration timing problem worth flagging. Teams that recently moved from AutoGen to Microsoft Agent Framework (the migration Microsoft has been pushing since AutoGen went into maintenance mode) are likely running newer versions of the dependency and may have upgraded recently. If you did that migration in the last couple of months, check the dates.

What To Check Right Now

If you use agent-framework in any Python project, here is what to do.

Check for the .pth files. Look in your site-packages directory for agent_framework_meta.pth and af_runtime_diag.pth. On Linux and macOS, that is typically in your virtualenv's lib/python3.x/site-packages/ directory. On a CI runner, check the runner's Python environment too.

find /usr -name "agent_framework_meta.pth" 2>/dev/null
find /usr -name "af_runtime_diag.pth" 2>/dev/null

Also check your project's virtualenv if you use one. The .pth files persist after the malicious package is removed.

Check your CI logs. Look at your run history for November 17 between 20:35 and 21:30 UTC. Any job that ran pip install agent-framework or pip install --upgrade agent-framework in that window should be treated as compromised.

Rotate if you are exposed. Azure service principal keys, storage account keys, GitHub personal access tokens, any API keys that were present as environment variables in the affected environment. Rotate all of them. Do not wait to confirm whether the exfiltration actually happened. The attacker had 55 minutes and an automated stealer. Assume they got what they were there for.

Pin your version now. Going forward: agent-framework==1.26.0 in your requirements file. The clean version is 1.26.0, published November 12. The Register confirmed that both malicious versions were removed, and the package is back on PyPI. But until there is a clear statement from Microsoft about how the pipeline was secured and what access was revoked, pinning is the right call. Auto-upgrading a package that just had its release pipeline compromised is not a good idea until you have confidence in what changed.

The Pattern Worth Noting

This is not the first time an AI framework's official release pipeline has been compromised this year. What is changing is that more small teams are now running AI agent frameworks in production, with real credentials and real cloud access attached, and those credentials are increasingly connected to things that matter.

Attackers have noticed. When a popular package gets 192,000 downloads a month and teams run it in environments with Azure and GitHub credentials, it becomes a high-value target. The 55-minute window is a sign of how fast the response was, not of how minor the exposure is.

The practical shift for small teams: treat your AI framework dependencies the same way you would treat a dependency with direct database access. Because that is what they are now. They run in environments with keys to your cloud. Pin them, audit them, and watch for unexpected version bumps.

The right instinct when a package releases two new versions in rapid succession and then immediately yanks them is to pause before upgrading. Most teams do not have a process for catching that. Building one is worth the hour it takes.

What We Help With

If you are not sure how your CI environments are configured or what credentials are exposed in your Python workflows, this is the kind of audit we do quickly. We help teams figure out what secrets are accessible in their agent environments and tighten their pipelines. It is usually a few hours of work.

Reach out at civsafe.ca if you want a fast assessment.

CivSafe — Strategic Innovation. Community Impact.