Agent-Framework PyPI Attack: A 45-Minute Window
It was a quiet Tuesday evening for Python developers. A new version of a trusted Microsoft package appeared on PyPI, the public index where Python developers download their libraries. Nothing about it looked wrong. The name was right, the publisher was right, and the code worked exactly as it should. That was the point.
The agent-framework PyPI attack began at 20:35 UTC on November 17, 2026, when version 1.26.1 of agent-framework landed on PyPI. It is the meta-package for Microsoft Agent Framework, the open-source toolkit for building AI agents in Python. The package draws around 190,000 downloads a month.
Thirty-three minutes later, at 21:08 UTC, a second version appeared: 1.26.2. By about 21:30 UTC, both were gone, quarantined by PyPI. The whole episode lasted less than an hour — but both releases carried a credential stealer built to harvest cloud tokens and API keys from every machine that installed them.
Researchers at Wiz, JFrog, Socket and Endor Labs flagged the compromise within hours. It was, according to The Hacker News, the second time this year that a Microsoft Python package had been hijacked on PyPI.
The .pth Trick: Malware That Runs Before Your Code
What made this attack so sneaky was not what the code did, but when it ran. The malicious versions left Agent Framework behaving normally. They added a tiny .pth file to Python’s site-packages folder, and Python executes import lines in .pth files every time the interpreter starts.
So the stealer ran whenever Python started in an affected environment, even if the developer never imported Agent Framework. Running pip, launching a test suite or starting a container was enough. Endor Labs put it plainly: the stealer runs on any Python launch, including pip itself.
Version 1.26.1 dropped a file called agent_framework_meta.pth holding a single line: import agent_framework_meta. That import called a hidden module, _telemetry.py, disguised as legitimate SDK telemetry. The stealer then forked into a detached background process and worked silently.
Version 1.26.2 was craftier still. Its authors restored the package’s __init__.py file to the exact clean version, so file comparisons against the legitimate release showed nothing wrong. The payload moved to a new module, af_runtime_diag.py, triggered by a new hook file. Searching only for the first version’s file names would miss it entirely.
What the Stealer Collected
The malware was aimed squarely at the cloud. It swept up environment variables whose names contained words like TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI and HF_, and it read the environments of up to 300 other processes on the same machine.
It also grabbed credential files: Azure CLI sessions, .npmrc, pip.conf, .netrc, .git-credentials, Docker configuration, Hugging Face tokens, Azure DevOps agent credentials and .env files.
But the stealer did not stop at secrets already on disk. As SafeDep noted, it also asked the platform to issue fresh credentials. On Azure machines it requested managed-identity tokens for twelve resources, from Key Vault and Storage to Azure AI and Container Registry.
In Azure DevOps pipelines it used the pipeline’s own access token to request federated identity tokens, and version 1.26.2 added the same trick for GitHub Actions workflows.
That matters, because rotating stored secrets would not have covered the stolen tokens. The fresh tokens were valid for up to 24 hours, and a federated token exchanged in Azure could open doors with no stored secret at all.
Everything collected was packed into a single JSON document, compressed, encoded and sent in one HTTPS request to a hard-coded webhook.site address. The scale of the target list explains why researchers reacted so fast. This was the official channel for one of Microsoft’s flagship AI frameworks.
How the Attackers Got Publishing Access
The biggest unanswered question is how the attackers managed to publish anything as Microsoft. Wiz Research, which reported the incident to Microsoft on the day it happened, believes a stolen signing credential is the answer.
The attackers appear to have compromised a client certificate and private key for Microsoft ESRP, the pipeline Microsoft uses to sign and publish this package. Their first attempt, launched from Amazon’s cloud, was rejected by ESRP’s IP filtering. A second attempt, routed through Microsoft-owned IP space, went through. How the credentials were obtained is still not known.
There is one more twist. The attacker’s own tooling reported its progress back to the same public webhook it used to collect stolen data, letting Wiz watch part of the operation unfold. The tooling identifies itself as Cairn, an open-source AI penetration-testing framework.
Before publishing, the attackers even test-ran the stealer on their own machine. That run captured the configuration of an AI coding agent — the open-source Pi harness, backed by a GLM-family model.
JFrog’s analysis added that the malicious wheel was repacked locally, not built by Microsoft’s release pipeline. Archive headers show it was zipped at 20:26 UTC, nine minutes before upload, on a UTC+8 machine.
Three Real Victims — and a Lucky Accident
For all its reach, the attack’s actual damage was limited by an accident of infrastructure. The exfiltration address was a free-tier webhook.site URL, which accepts at most 100 requests. Wiz confirmed the attackers’ token was on the free tier, and only 50 requests were ever captured.
Wiz analysed all 50. Four came from the attackers’ own machines, and twenty-nine were linked to sandboxes, vendor scanning and security tests. The remaining seventeen represented just three unique cases of real victim data being stolen. Those three did contain working cloud, CI and registry credentials — but the blast radius was far smaller than the download count suggested.
Speed worked both ways. Automated dependency bots such as Renovate were already opening upgrade pull requests in downstream repositories within six minutes of the malicious version landing, according to JFrog. Had the exfiltration channel not capped out, the same automation could have spread the compromise just as fast.
The pattern will be familiar to anyone who followed the Railway breach, where stolen AI provider keys racked up hundreds of thousands of dollars in fraudulent charges. The target has shifted from stealing data to stealing the keys that unlock cloud services. The Fireworks AI breach in October showed the same hunger for AI infrastructure.
Microsoft’s Response
Microsoft’s public response arrived on November 20, when The Hacker News updated its report to include a company statement. Microsoft has made some of its repositories private while it investigates, including microsoft/agent-framework and microsoft/onnxruntime.
A spokesperson said the company’s priority was to protect customers and the broader ecosystem, and that it would take further action as needed.
The company has not yet said how the ESRP credentials were obtained, how many users installed the poisoned versions, or whether any Microsoft systems were affected. No CVE identifier has been assigned.
This is the second Microsoft-related PyPI compromise this year. In May 2026, attackers pushed three malicious versions of durabletask, Microsoft’s Python client for the Durable Task workflow framework, to distribute the Mini Shai-Hulud worm. Wiz said it had not linked the two incidents — but the same trust model failed twice in six months.
What to Do If You Installed 1.26.1 or 1.26.2
If you installed either version between 20:35 and about 21:30 UTC on November 17, assume the environment is compromised. Check your lockfiles, CI logs, virtual environments and container images for agent-framework 1.26.1 or 1.26.2, and pin the package back to 1.26.0. Then rebuild from a clean environment instead of cleaning the infected one in place.
Look inside site-packages for the tell-tale files: agent_framework_meta.pth and agent_framework_meta/_telemetry.py for 1.26.1, or af_runtime_diag.pth and af_runtime_diag.py for 1.26.2. Any Python process started in that environment ran the payload, so either file confirms exposure.
Check your proxy and DNS logs for requests to the exfiltration address, webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb. A successful response means that host’s data was accepted.
Then rotate every secret that was present in the environment — Azure CLI sessions, DevOps tokens, npm, PyPI, NuGet, Docker and Hugging Face tokens, and git credentials — from a clean system.
Teams running GitHub Actions should pay special attention if they installed 1.26.2 in a workflow with id-token write permission. Those workflows’ OIDC tokens for Azure should be treated as exposed, along with the Entra ID federated credentials that trust them. Review sign-ins for the matching app registrations and rotate the secrets the job could see.
The incident is a reminder that the software supply chain is now a front line in AI security. Developers trust package indexes the way they trust app stores, and that trust is what the attackers exploited. A 45-minute window and a stolen signing credential were all it took to turn Microsoft’s own AI framework into a credential thief.



