agent-framework on the Python Package Index (PyPI), versions 1.26.1 and 1.26.2, quietly collected cloud, CI/CD and developer secrets and sent them to a throwaway web endpoint. This was not a typosquat with a lookalike name. Researchers say the malicious releases were found under the legitimate Microsoft-associated PyPI publisher, not under a lookalike name.Both versions are gone from PyPI. That doesn't fix machines that already installed them. If you build agents on Azure, run Azure DevOps pipelines or deploy to Azure from GitHub Actions, check your environments today.
What happened, minute by minute
The timeline from Wiz and SafeDep is short:
| Time (UTC) | Event |
|---|---|
| Nov 12, 18:25 | Legitimate 1.26.0 published as a wheel plus source distribution, alongside agent-framework-core 1.26.0 |
| Nov 17, 20:35:20 | Malicious 1.26.1 published as a wheel only |
| Nov 17, 20:57 | SafeDep flags 1.26.1 |
| Nov 17, 21:08:39 | Malicious 1.26.2 published, after 1.26.1 had been pulled |
| Nov 17, ~21:30 | Wiz reports both versions no longer available |
PyPI quarantined both releases. StepSecurity notes the uncomfortable part: the 1.26.2 release was published after PyPI quarantined 1.26.1, which means simple removal does not contain this incident. Whoever had publishing access still had it after the first takedown.
agent-framework is the meta-package for Microsoft Agent Framework, Microsoft's open-source Python framework for building and orchestrating AI agents and multi-agent workflows. Estimates of its traffic differ. Reporting puts it at about 190,000 downloads a month, SafeDep counts roughly 192,000, and Wiz put normal package traffic at about 41,000 downloads per week. Nobody has a count of how many installs the two bad versions received.
Section summary: For about an hour, a fresh pip install agent-framework with no pinned version could pull a credential stealer from Microsoft's real package name. The clean release to go back to is 1.26.0.
How the stealer ran
The malware hid in a .pth file. Python's site module runs any line that starts with import in a .pth file under site-packages every time the interpreter starts. Your code never has to import Agent Framework. Running Python in that environment is enough, and that includes running pip.
The two versions hid the payload in different places:
- 1.26.1 dropped
agent_framework_meta.pth, a one-line file that importsagent_framework_meta. A hook appended to that module's__init__.pystarted the collector inagent_framework_meta/_telemetry.py. - 1.26.2 restored the package's original initializer and moved the malicious code into af_runtime_diag.py, triggered by af_runtime_diag.pth. SafeDep confirmed the restored
__init__.pyis byte-for-byte identical to the clean 1.26.0 file. Checking the initializer alone will clear an infected 1.26.2 environment. A scan that only looks for 1.26.1's file names will miss 1.26.2.
The collector was built to go unnoticed. Wiz found it forks into a detached session on systems that support fork, so builds and tests show no delay. Where fork isn't available it falls back to a daemon thread. It sets _AF_TEL=1 so child processes don't collect twice, though each new top-level Python launch can run it again. Function names, comments and user agents were made to look like ordinary SDK telemetry.
The malware also didn't break anything. According to OX Security, because it pulls in the genuine agent-framework-core 1.26.0 as a dependency, the framework keeps working normally and the compromise is easy to miss.
What it took
The payload is aimed mainly at Azure and Azure DevOps, with some broader reach:
- Environment variables whose names contain credential-related strings such as
TOKEN,SECRET,PASSWORD,KEY,AZURE,AWS,GITHUB,OPENAI,HF_,FOUNDRY,NPM,PIP,NUGET,SYSTEM,BUILDand XF_ICODE_BLK0033. Version 1.26.2 adds ACTIONS, OIDC, RUNNER, and ARM. SafeDep says up to 8,000 characters of each value were kept. - Other processes' environments. On Linux it read up to 300
/proc/*/environfiles. On a shared or self-hosted runner, that can expose secrets belonging to other jobs. - Credential files: up to 60 in 1.26.1 and 80 in 1.26.2. Targets include Azure CLI JSON under
~/.azure,.npmrc,pip.conf,.netrc,.git-credentials, Dockerconfig.json, Hugging Face tokens, Azure AI Foundry configuration, Azure DevOps agent.credentialsfiles, and.envand JSON files under/appand/workspace. Version 1.26.2 added GitHub-hosted runner paths. - Newly requested tokens. SafeDep explains why this part matters most: "Rotating stored secrets does not cover those."
The token requests worked differently on each platform:
- Azure DevOps: If
SYSTEM_ACCESSTOKENandSYSTEM_OIDCREQUESTURIwere present, it requested a federated token forapi://AzureADTokenExchange. That's the token a workload identity federation service connection uses to sign in to Azure. - Azure compute: It queried the managed identity endpoint for tokens to 12 resources. That's
IDENTITY_ENDPOINT/MSI_ENDPOINTon App Service and Functions, and the instance metadata service at169.254.169.254elsewhere. Token audiences include Azure management, AI/ML, Cognitive Services, Storage, Key Vault, Search, Microsoft Graph, Container Registry, Azure DevOps, and Azure AD token exchange. It also collected instance metadata. - GitHub Actions (1.26.2 only): In workflows with
id-token: write, it requested OIDC tokens forapi://AzureADTokenExchangeand[url]https://management.azure.com/[/url]. If an Entra ID federated credential trusts that workflow, those tokens can be exchanged for Azure access with no stored secret involved.
Everything was packed into one JSON document, compressed with zlib, Base64-encoded and sent in a single HTTPS POST to webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry. The user agent was af-runtime-diagnostics/1 for 1.26.1 and runtime-diagnostics/1 for 1.26.2.
Section summary: This was a theft of identities as well as stored secrets. A managed identity or federated pipeline could give away fresh, scoped Azure tokens. Wiz notes those tokens are valid for up to 24 hours.
Did the webhook limit the damage?
Possibly, but don't rely on it. Wiz found the attacker used an anonymous free-tier webhook.site URL. Those accept at most 100 requests and expire after seven days, and Wiz says no more than 50 requests were captured. That's an unusually basic choice of infrastructure for an attack on a Microsoft package.
That figure doesn't mean only 50 machines were affected or that nothing useful was stolen. A single captured request could hold working Azure, CI or registry credentials. Wiz offers a practical test: in proxy logs, an HTTP 200 to that URL means the host's data was accepted, and a 410 or 429 suggests it was turned away.
Who did it, and how?
That's still unknown. Wiz found no python-1.26.1 tag or release in the microsoft/agent-framework GitHub repository, and no malicious code on the main branch. Both bad releases were wheel-only, while every release from 1.20.0 through 1.26.0 shipped a wheel and a source distribution. That suggests someone built and uploaded them outside the normal release process. It doesn't prove how they got access.
SafeDep reports that PyPI lists a second maintainer on the project, an account that joined on November 17 and can also publish to five sibling projects. SafeDep calls it the suspected uploader but says neither PyPI nor Microsoft has confirmed that. StepSecurity first made a similar claim, and its revised analysis reportedly says the evidence doesn't establish the account, credential or way in. OX Security's theory is that attackers hijacked the wheel-creation flow. Treat all of these as theories for now.
SafeDep adds a point that applies whatever the answer turns out to be. PyPI had no attestation for the clean 1.26.0 either, so both malicious versions looked no less trustworthy than Microsoft's real uploads. Users had no cryptographic way to tell them apart.
This is also the second time this year. In May 2026, malicious versions of durabletask, Microsoft's Python client for the Durable Task framework, went up on PyPI using a stolen token. Reports attributed those to the TeamPCP crew distributing the Mini Shai-Hulud worm. Wiz and SafeDep both say they have found nothing linking the two incidents.
What to do now
- Don't start Python first. Running Python or
pipin a suspect environment can trigger the hook again. Be careful with the common advice to runpip uninstall, which StepSecurity's remediation includes. Inspect with non-Python tools first. - Find exposure. Search lockfiles, requirements files, CI logs, container images, and pip/uv caches and internal mirrors for
agent-framework1.26.1 or 1.26.2. SafeDep's lockfile check isgrep -rnE 'agent[-_]framework.{0,20}1\.26\.[12]\b'across.txt,.lock,.tomland.cfgfiles. - Hunt for the hooks. Look in
site-packagesforagent_framework_meta.pth,agent_framework_meta/_telemetry.py,af_runtime_diag.pth,af_runtime_diag.py, and theagent_framework-1.26.1.dist-infooragent_framework-1.26.2.dist-infofolders. On Linux, SafeDep usesfindacrosssite-packagesfor the two.pthnames. On Windows, a PowerShellGet-ChildItem -Recursesearch for the same file names does the same job without starting Python. That's general practice, not vendor guidance. - Check network logs for the full webhook path and both user agents. Webhook.site is a legitimate service, so match the full URL rather than flagging the whole domain.
- Contain and rebuild. Isolate affected hosts and runners, keep the evidence, and rebuild from a clean image. If you must clean in place, delete the hook and payload files before running Python.
- Pin and block. Pin
agent-framework==1.26.0, block 1.26.1 and 1.26.2 in package proxies, and purge cached wheels. SafeDep warns that pinning only the meta-package leaves its four sibling dependencies free to update. Lock the full dependency tree with hashes, usingpip-compile --generate-hashesoruv lock. - Rotate and audit from a clean machine. Rotate environment secrets, Azure CLI sessions, Azure DevOps PATs and service connections, and npm, PyPI, NuGet, Docker and Hugging Face tokens. Review Entra ID sign-in and activity logs for managed identities and federated credentials reachable from affected VMs, App Services, AKS nodes and pipelines. For GitHub workflows that installed 1.26.2 with
id-token: write, assume the Azure OIDC tokens were exposed.
The bigger picture
AI agent frameworks run inside CI pipelines that hold the keys to cloud tenants, which makes them very attractive targets. OX Security described the attack as targeting environment secrets, cloud and package-manager credentials, and Azure managed identity tokens. SafeDep says the same one-line .pth loader showed up in LiteLLM 1.107.0 in October. Teams should audit for this technique, not just watch for this package.
Response was fast: SafeDep flagged 1.26.2 four minutes after upload. Even so, unpinned builds had about an hour in which they could install a stealer from a trusted name, and the attacker published a second version after the first takedown. If your agent pipelines use floating versions, it's a good time to switch to hash-locked dependencies.
Update: Second malicious release reportedly quarantined within minutes (November 18, 2026)
BleepingComputer reports that version 1.26.2 was quarantined roughly eight minutes after it was published. The outlet also says the attacker uploaded that second release about 2.5 minutes after PyPI quarantined the first one, reinforcing that the publisher retained access during the response window.
References
- Microsoft’s Agent Framework PyPI package compromised to steal credentials BleepingComputer · 2026-11-18T11:58:42-05:00
- Attackers compromise Microsoft's agent-framework PyPI package to steal cloud credentials - news.lavx.hu news.lavx.hu · 2026-11-18T08:23:07.151000+00:00
- Microsoft agent-framework Compromised Twice on PyPI safedep.io