Microsoft Agent Framework PyPI Attack: What to Rotate Now

By 6 min read
Microsoft Agent Framework PyPI attack: poisoned agent-framework 1.26.1 and 1.26.2 wheels hid a .pth startup hook that stole cloud and CI credentials

Two releases of Microsoft’s own AI agent library carried a credential stealer that fired every time Python started. Nobody had to import the package for it to run.

In short: on 17 November 2026, versions 1.26.1 and 1.26.2 of the agent-framework package on PyPI were published with a hidden startup hook that harvested Azure, Azure DevOps and GitHub Actions credentials and posted them to a webhook. Both were pulled within the hour, and 1.26.0 is the last clean version. If either version ever landed in your environment, assume its secrets are gone.

What happened in the Microsoft Agent Framework PyPI attack?

An attacker uploaded two wheel-only releases of agent-framework, a Python package with roughly 190,000 monthly downloads according to Orca Security and SafeDep. The legitimate 1.26.0 had shipped on 12 November with both a wheel and a source archive; the poisoned versions had only wheels.

Neither release changed the framework’s real code or added a dependency. The package kept working, which is exactly why automated update bots happily picked it up. JFrog says Renovate pull requests appeared within six minutes of 1.26.1 landing.

Three headline numbers: 190,000 monthly downloads, 33 minutes between releases and 3 real victims.
A package with about 190,000 monthly downloads was poisoned twice, yet Wiz counted only three real victims.

When I checked on 28 November, PyPI listed 1.26.0 as the latest release and the microsoft/agent-framework GitHub repository returned a 404. SecurityWeek reported the repository was already unreachable on 18 November and says it is unclear whether that is linked to the attack.

Timeline

Time (UTC, 17 Nov 2026) Event Source
20:26 Malicious wheel repacked locally JFrog
20:35 agent-framework 1.26.1 published GitHub advisory, Wiz, SafeDep
20:57 SafeDep flags 1.26.1 as malicious SafeDep
21:06 1.26.1 quarantined JFrog
21:08 agent-framework 1.26.2 published GitHub advisory, Wiz
21:12 SafeDep flags 1.26.2 SafeDep
21:16 to 21:30 Both versions gone from PyPI JFrog says 21:16, Wiz says by about 21:30

GitHub published advisory GHSA-764m-3ppc-5m73 on 18 November. It lists no patched version, because the fix is simply not to use 1.26.1 or 1.26.2.

How did the stealer work?

The trick was a .pth file. Python reads these files from site-packages at startup and executes import lines inside them, so the payload ran on every interpreter launch.

According to the GitHub advisory, Wiz and JFrog, the payload:

  • forked into a detached background process and set an _AF_TEL marker so it ran once
  • collected environment variables whose names contain strings such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB and OPENAI, plus secrets from up to 300 other processes via /proc
  • read credential files including Azure CLI state, .npmrc, .netrc, .git-credentials, Docker config, Hugging Face tokens and .env files
  • requested Azure managed-identity tokens for 12 resources and Azure DevOps OIDC tokens
  • compressed everything and sent one HTTPS POST to a webhook.site URL

Version 1.26.2 changed tactics. It restored the original __init__.py byte for byte, moved the payload into new files named af_runtime_diag.pth and af_runtime_diag.py, and added GitHub Actions OIDC token theft for workflows with id-token: write. Orca reads the clean __init__.py as an attempt to beat diff-based review.

Five-stage flow of the stealer from the .pth startup hook to a single HTTPS POST.
The payload ran before anyone imported the package, so every Python launch in the environment was a trigger.

How did the attacker get publishing access?

This is where sources disagree, and nobody has a confirmed answer.

Source Explanation
Wiz Attacker appears to have used a stolen client certificate and key for Microsoft’s ESRP release pipeline; a first attempt from AWS was blocked by IP filtering, a second from Microsoft-owned IP space succeeded
SafeDep A PyPI account called vibiret, created on 17 November, appears as a maintainer with rights to agent-framework and five sibling packages; not confirmed as the uploader
JFrog The wheels were repacked on a local machine, not built by Microsoft’s pipeline

These may fit together, but no source says so. None of the four pages I read quotes an official Microsoft statement. SecurityWeek reports that a project maintainer confirmed the removal and an investigation on GitHub.

Was AI involved?

Wiz reports that the attacker’s tooling named itself Cairn and staged files under /tmp/cairn_pkg. Cairn is an open-source AI pentest framework that already turned up in a zero-day intrusion we covered in Cairn: the AI agents that found a zero-day on their own. Wiz also saw a configuration for an AI coding-agent harness with a GLM-family model.

That tells you about the tooling, not the operator. No source attributes the attack to a known group.

The catch: it was sloppy, and that helped

The stealer was not well engineered. Wiz found the exfiltration endpoint was a free webhook.site token, which caps at 100 requests. Of the 50 requests Wiz could account for, only 17 came from 3 distinct real victims; the rest were the attacker’s own tests, sandboxes and vendor scans.

JFrog found the Azure DevOps token request was malformed and would fail on real Azure DevOps, and that there was no persistence, worm or second stage. It also found the same webhook leaked the attacker’s own progress reports, which is how Wiz reconstructed much of the story.

Do not read that as “low risk”. Stolen managed-identity tokens can be valid for up to 24 hours, per Wiz, and three real victims is enough for a breach. It is the same pattern as the 1Password breach that started with a stolen GitHub token: one developer credential reaches production.

What should defenders do?

  1. Search lockfiles, CI logs, virtual environments, container images and package mirrors for agent-framework 1.26.1 or 1.26.2.
  2. Look in site-packages for agent_framework_meta.pth or af_runtime_diag.pth without starting Python. JFrog warns that running pip in an infected environment triggers the hook, so neutralise it first.
  3. Rotate every secret reachable from an affected host or runner: Azure service principals, Azure DevOps tokens and service connections, GitHub tokens, npm, PyPI, Hugging Face and registry credentials. JFrog adds that cached Entra ID refresh tokens survive password resets.
  4. Hunt in proxy and DNS logs for POSTs to webhook.site and the User-Agents af-runtime-diagnostics/1 and runtime-diagnostics/1. Wiz notes HTTP 200 means data was accepted.
  5. Audit Azure managed identity sign-ins, federated credentials and GitHub Actions runs from 17 November onward.
  6. Pin to 1.26.0 with hash checking and evict cached malicious wheels from internal mirrors using the hashes in the GitHub advisory.

The same habits would have blunted PolinRider’s poisoned GitHub repositories: pin with hashes, delay auto-merging fresh releases, and treat CI runners as production.

The bottom line

The Microsoft Agent Framework PyPI attack lasted under an hour and still reached real victims, because a .pth hook runs before anyone imports anything. The publishing path is still unexplained, so a trusted vendor name was not protection. If 1.26.1 or 1.26.2 ever touched a machine, rotate first and investigate second.

Sources

This article is written for defenders and authorised security testers. Only test systems you own or have written permission to assess.

Frequently asked questions

Which agent-framework versions are malicious?

Versions 1.26.1 and 1.26.2 of the agent-framework package on PyPI, both published on 17 November 2026. GitHub advisory GHSA-764m-3ppc-5m73 lists only these two. Version 1.26.0 and earlier are not affected.

Was I affected if I never imported agent_framework?

Possibly. The malicious wheels installed a .pth file, which Python runs automatically at interpreter startup. Any Python process in that environment, including pip itself, would trigger the stealer.

How did attackers publish to Microsoft's PyPI package?

It is not confirmed. Wiz says the attacker appears to have used a stolen client certificate for Microsoft's release pipeline. SafeDep points to a new PyPI maintainer account added that day. JFrog found the wheels were repacked by hand rather than built by Microsoft's pipeline.

What did the agent-framework malware steal?

Environment variables with names like TOKEN, SECRET or KEY, secrets from other processes, credential files such as .npmrc, .netrc and Docker config, Azure managed-identity tokens, Azure DevOps OIDC tokens and, in 1.26.2, GitHub Actions OIDC tokens.

Who was behind the agent-framework PyPI compromise?

No vendor has named an actor. GitHub, JFrog and SafeDep all say they have not attributed it. Wiz reports the attacker's tooling called itself Cairn, an open-source AI pentest framework, but that describes the tool, not the person.

Keep reading

Microsoft Agent FrameworkPyPI supply chain attackagent-frameworkPython securityCI/CD securityAzureincident response