Two Poisoned Releases of Microsoft's agent-framework Package Ran a Credential Stealer Every Time Python Started
Versions 1.26.1 and 1.26.2 of Microsoft's agent-framework package were published to PyPI on November 17, 2026 with a hidden credential stealer that ran at interpreter start-up through .pth files. Wiz says the attacker appears to have used a compromised Microsoft release-pipeline certificate and an open-source AI penetration-testing tool. Version 1.26.0 is the last clean release.
Anyone who installed Microsoft’s agent-framework Python package during a 55-minute window on November 17 should treat that environment as compromised, according to GitHub’s advisory and security firm Wiz. Two malicious versions of the package, 1.26.1 and 1.26.2, were uploaded to PyPI that evening with a credential stealer added to otherwise legitimate code. Both have since been removed, and 1.26.0 is the most recent safe release.
agent-framework is the Python entry point for Microsoft Agent Framework, the company’s toolkit for building AI agents. Cloud security firm Wiz, which published a detailed analysis, says the package gets about 41,000 downloads a week. A GitHub Security Advisory, GHSA-764m-3ppc-5m73, classifies both versions as embedded malicious code.
A start-up hook instead of an import
According to Wiz’s timeline, version 1.26.1 appeared on PyPI at 20:35 UTC on November 17. Version 1.26.2 followed at about 21:08 UTC, and both were gone by about 21:30 UTC. The previous legitimate release, 1.26.0, had been published on November 12.
The trick was the delivery mechanism. Each malicious wheel dropped a .pth file into the root of site-packages: agent_framework_meta.pth in 1.26.1 and af_runtime_diag.pth in 1.26.2. Python processes .pth files every time an interpreter starts, so the stealer ran whenever Python launched in an affected environment, even if no code ever imported agent_framework. The GitHub advisory says the rest of each wheel matched 1.26.0.
The code was dressed up as telemetry. Wiz says the files and functions used names such as _telemetry and “Lightweight runtime diagnostics hook,” with a user agent of af-runtime-diagnostics/1. The stealer detached into its own session or fell back to a background thread, and set an environment marker, _AF_TEL=1, so it would not run again in child processes.
Azure, GitHub and Hugging Face credentials in the sweep
Wiz describes the payload as focused on Azure and Azure DevOps. It gathered environment variables whose names contained strings such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, OPENAI and HF_, and scraped secret-looking values from up to 300 other processes’ environments. It read up to 60 credential files, including Azure CLI data, .npmrc, pip.conf, .netrc, .git-credentials, Docker configs, Hugging Face tokens, Azure DevOps agent credentials, and .env and JSON files under /app and /workspace.
It also requested live tokens. In Azure DevOps pipelines it asked for an OIDC token for Azure AD token exchange, and on Azure hosts it pulled managed-identity tokens for 12 resources, including Azure Resource Manager, Microsoft Graph, Key Vault and Storage. Everything was compressed, encoded and sent in a single HTTPS POST to a hardcoded webhook.site address.
Version 1.26.2 was a repack with three notable changes. It left the original module file clean and moved the trigger into a new top-level af_runtime_diag.py, so defenders searching only for 1.26.1 file names would miss it. It added theft of GitHub Actions OIDC tokens in workflows with id-token: write, which Wiz notes can be exchanged for Azure access wherever an Entra ID federated credential trusts the workflow. And it raised the file cap from 60 to 80.
A stolen signing credential and an AI pentest tool
Wiz says the attacker’s own tooling sent progress updates to the same public webhook, which let its researchers watch part of the operation. Based on that, Wiz says the attacker appears to have compromised a client certificate and private key for Microsoft ESRP (Engineering System Release Pipeline), the internal service Microsoft uses to sign and publish the package. A first publish attempt from AWS was rejected by ESRP’s IP filtering; a second, from Microsoft-owned IP space, succeeded. How the credentials were obtained is not yet known.
The tooling identified itself as Cairn, which Wiz describes as an open-source AI penetration-testing framework. Before publishing, the attacker ran the stealer on their own machine, and that run captured what Wiz says appears to be the open-source Pi coding-agent harness backed by a GLM-family model. Wiz says it notified Microsoft of its findings on November 17 and says it has not linked the incident to an earlier compromise of Microsoft’s durabletask package.
Limited haul, real credentials
The attacker used webhook.site’s free tier, which accepts at most 100 requests per URL. Wiz says a maximum of 50 requests were captured. In an update on November 18, it said four came from the attacker, 29 appeared to come from sandboxes, vendor scanners and tests, and the remaining 17 represented three unique, successful exfiltrations of victim data.
Wiz and the advisory both tell affected users to treat exposed environments as compromised. Recommended steps include searching lockfiles, CI logs, virtual environments and container images for the two versions, pinning to 1.26.0, checking site-packages for the .pth files, searching proxy and DNS logs for the webhook URL, and rotating every reachable secret. Wiz notes that stolen managed-identity and OIDC-exchanged tokens stay valid for up to 24 hours, so Azure sign-in logs and federated credentials also need review.
- #Supply Chain
- #PyPI
- #Microsoft Agent Framework
- #Credential Theft
- #Azure
Author
Raj M
Contributor
AI Systems Architect is a seasoned technology leader with over 15 years of experience in the IT industry working with Fortune 500 companies. With a solid foundation in multi-agent systems, open-source LLM infrastructure, and enterprise deployment, he excels at building scalable production-grade AI platforms.