Microsoft agent-framework PyPI compromise: what to check
The agent-framework PyPI compromise put a credential stealer in versions 1.26.1 and 1.26.2. How it runs, how to check your machines and what to rotate.
The agent-framework PyPI compromise hit a package most teams trust by default: Microsoft's own agent SDK. On November 17, 2026, two malicious versions of agent-framework, 1.26.1 and 1.26.2, were uploaded to PyPI 33 minutes apart. Both carry a credential stealer aimed at Azure, Azure DevOps and GitHub Actions secrets.
What worries me most is how it runs. You don't have to import the package. Installing it is enough, because the stealer hooks Python's startup and fires every time a Python process starts in that environment.
PyPI quarantined both versions in under 45 minutes. That is fast, and every CI job or image build that resolved agent-framework in that window still has to assume its secrets are gone. Here is what happened, how to check, and what to rotate.
What happened in the agent-framework PyPI compromise
The timeline below comes from StepSecurity's analysis, Wiz and SafeDep. All times are UTC on November 17.
- At 20:35, version 1.26.1 appears on PyPI as a single wheel with no source distribution. The clean 1.26.0, published on November 12, shipped a wheel and an sdist like every recent release.
- At 20:57, SafeDep flags 1.26.1. PyPI quarantines it at 21:06.
- At 21:08, about two minutes after that quarantine, 1.26.2 is uploaded. Whoever did this still had publishing access.
- At 21:16, PyPI quarantines 1.26.2 as well.
I checked the registry on November 18. latest is back on 1.26.0, and the JSON endpoints for 1.26.1 and 1.26.2 return 404. The package had 195,912 downloads in the last month and 39,963 in the last week according to pypistats. Nobody has published how many of those were the bad versions.
The root cause is still unknown. Wiz found no python-1.26.1 tag in the microsoft/agent-framework repo and no malicious code on main, which suggests the wheels were built outside the release pipeline and uploaded directly. Aikido thinks someone unpacked a legitimate wheel, edited it by hand and re-uploaded it: the WHEEL file kept an old placeholder timestamp and the injected files were world-writable.
SafeDep also noticed a second PyPI maintainer on the project, an account named vibiret that was created on November 17 and can publish to agent-framework and five sibling packages. It is not confirmed as the uploader, because PyPI doesn't publish who uploaded a file. When I looked on November 18, the project page still listed two maintainers, microsoft and vibiret.
Microsoft hasn't published a root cause. SecurityWeek reports that a maintainer confirmed the removal and an investigation in a GitHub issue. I couldn't read it: the microsoft/agent-framework repository returned a 404 when I tried.
How the stealer runs without an import
Both versions drop a .pth file into site-packages. Python's site module reads those files at startup and executes any line that begins with import. So the payload runs on every interpreter start, including pip, test runners and unrelated scripts that share the environment.
In 1.26.1 the hook is agent_framework_meta.pth, which loads agent_framework_meta/_telemetry.py. In 1.26.2 it moved to af_runtime_diag.pth and a top-level af_runtime_diag.py, and the package's __init__.py was restored to the clean version. Socket's review points out that anyone who inspected only that file would have missed the second release.
On Linux and macOS the payload forks and detaches, then sets _AF_TEL=1 so child processes don't run it again. The file names are chosen to look like SDK telemetry, and the framework itself keeps working, so nothing breaks.
What it collects
Per Wiz, Socket and Aikido, the stealer gathers:
- environment variables whose names contain strings like
TOKEN,SECRET,KEY,AZURE,AWS,GITHUBandOPENAI - the environments of up to 300 other processes through
/proc/*/environ - credential files: Azure CLI state in
~/.azure,.npmrc,pip.conf,.netrc,.git-credentials, Dockerconfig.json, Hugging Face tokens, Azure DevOps agent.credentials, and.envor JSON files under/appand/workspace - fresh Azure managed-identity tokens for 12 resources, including Resource Manager, Graph, Key Vault and Storage
- in 1.26.2, GitHub Actions OIDC tokens from workflows that have
id-token: write
Everything goes out in one compressed HTTPS POST to a hardcoded webhook.site URL. Socket says the payload doesn't download or run further code.
Two details matter for cleanup. The /proc sweep means a job on a shared or self-hosted runner can leak secrets that belong to other jobs. And because the stealer requests new tokens instead of only copying stored ones, SafeDep notes that rotating stored secrets doesn't revoke them. Wiz says those tokens can stay valid for up to 24 hours.
How to check if you are affected
Search the filesystem first. pip is a Python program, so running it inside an infected environment starts the hook again.
find / -xdev \( -name 'agent_framework_meta.pth' \
-o -name 'af_runtime_diag.pth' \
-o -name 'af_runtime_diag.py' \) 2>/dev/null
grep -rnE 'agent-framework==1\.26\.[12]' . --include='*.txt'
grep -rn -A1 'name = "agent-framework"' . --include='*.lock'
The second grep is for uv.lock and poetry.lock, which keep the name and version on separate lines.
Then check the places a 45-minute window hides: CI logs from the evening of November 17 (UTC), pip and uv caches on runners, container images built since then, and any internal PyPI mirror. The wheel hashes Socket and Aikido list are:
1.26.1 d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110
1.26.2 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9
Look at proxy and DNS logs for webhook.site too. Most build infrastructure has no reason to talk to it.
If you get a hit:
- Pin
agent-framework==1.26.0and rebuild the environment or image. Don't clean it in place. - Rotate everything that host could read: Azure service principal secrets, Azure DevOps PATs and service connections, GitHub, npm, PyPI, Docker and Hugging Face tokens, and the contents of any
.envfile. - Review Entra ID sign-in logs for the managed identities and federated credentials those jobs use.
- If 1.26.2 ran in GitHub Actions with
id-token: write, review the federated credentials that trust that repository.
SafeDep also recommends holding off on new releases of agent-framework and its five sibling packages until Microsoft confirms the publisher access is cleaned up. I agree.
What I'd change after this
Yesterday I wrote about the WPPConnect npm compromise, where the malicious release came out of the project's real pipeline with valid provenance. This one is the opposite. There was no attestation on the bad wheels, but the clean 1.26.0 has none either, so consumers had nothing to compare against. If you publish packages, ship attestations on every release so a missing one means something.
On the consumer side, these habits would have kept both versions out of a build:
- Add a release cooldown. uv has
--exclude-newerand Renovate hasminimumReleaseAge. SafeDep flagged 1.26.1 in 22 minutes, and a one-day delay would have skipped both versions. - Install from a lockfile with hashes. A new version can't slip into a build that only accepts known digests.
- Keep CI identities narrow. Grant
id-token: writeonly to the jobs that deploy, and scope managed identities to the resources a job needs.
Agent SDKs deserve extra care here because of where they run: next to model keys, cloud credentials and customer data. I covered related ground in my posts on Microsoft's Copilot SDK 2.0 runtime and the Cursor security incident.
FAQ
Am I affected if I never imported agent-framework?
Yes, if 1.26.1 or 1.26.2 was installed. The .pth hook runs when any Python interpreter starts in that environment.
Is agent-framework 1.26.0 safe?
Researchers name 1.26.0 as the last clean release, and it is the current latest on PyPI. Pin that exact version until Microsoft publishes a root cause.
Does uninstalling the package fix it?
It stops the hook, but it doesn't undo anything already sent. Rebuild the environment and rotate credentials.
Sources
- Microsoft agent-framework PyPI package compromised, StepSecurity
- Microsoft agent-framework compromised: credential stealer targets Azure and CI pipelines, Wiz
- Microsoft's agent-framework PyPI package compromised with credential stealer, Socket
- Two malicious agent-framework releases hit PyPI in 33 minutes, Aikido
- Microsoft agent-framework compromised twice on PyPI, SafeDep
- agent-framework on PyPI
Cover image: Microsoft Agent Framework announcement image, Microsoft Foundry Blog
Related articles
Microsoft Copilot SDK 2.0: one runtime, many agent sessions
Microsoft Copilot SDK 2.0 runs many isolated agent sessions in one Rust runtime with per-user identity. What changed, the trade-offs, and what to check first.
WPPConnect npm compromise: what to check and rotate
The WPPConnect npm compromise shipped a secret stealer through trusted publishing. How the attack worked, how to check your systems and what to rotate.
Cursor security incident: how a vendor key led to malware
The Cursor security incident began with a leaked Fireworks key and ended in a backdoored Claude Code extension. What happened and how to check your machine.