Today is Friday, November 20, 2026. Three days ago in the afternoon, something happened that was worth every person working on enterprise AI stopping to take a look at.
On November 17, two versions of Microsoft's official AI agent development framework Python package agent-framework were uploaded to PyPI containing credential-stealing code: 1.26.1 and 1.26.2. This is not a counterfeit package, nor a lookalike imitation—it is the official package published by a Microsoft-associated account and used by developers worldwide to build AI Agent workflows.
This package's monthly download volume (OX Security statistics), approximately 200,000 per month
What makes it even more troublesome is how it is triggered: as soon as the Python interpreter in an infected environment starts, the malicious code runs automatically—you do not need to import this package, nor call any of its functions. For enterprises that install Agent frameworks on developer machines, CI/CD build machines, and cloud runners, this is an incident that directly turns the "development toolchain" into an attack entry point.
1. It is not counterfeiting; it is that the trust chain of the "official publisher" has broken.
In the past, when discussing supply chain attacks, the most common was typosquatting—creating a name that looks extremely similar to the legitimate one, betting that you'll make a slip. This time it is completely different. According to Security Insider's analysis, the malicious version was uploaded by a legitimate PyPI publisher account associated with Microsoft, and it is preliminarily judged that the account was hijacked and taken over by attackers.
The timeline provided by StepSecurity is quite telling: as soon as 1.26.1 went live, it was implanted with a payload; after being quarantined by PyPI, the attacker uploaded 1.26.2 again. The two versions were about 2 minutes 23 seconds to 8 minutes apart (sources differ slightly). The fact that the second version could be published after the first was taken down indicates that the attacker most likely still held publishing permissions at the time.
| 31 minutes | 8 minutes |
|---|---|
| 1.26.1 Online window (MST 13:35–14:06, StepSecurity timestamp) | 1.26.2 Online window (MST 14:08–14:16), subsequently quarantined |
The window is very short, but this does not mean the impact is small. Mirror sites, Docker images, and artifact caches such as Artifactory/Nexus will "freeze" these two versions for a long time. The conclusions from multiple organizations are consistent: any environment that has installed 1.26.1 or 1.26.2 should be directly regarded as having had its credentials leaked, rather than "check first and then decide." The last clean version is 1.26.0.
What this incident shattered was three things: trust in project names, trust in publisher identities, and trust in dependency lockfiles. When the combination of "official package + locked version" is no longer safe, enterprises need to rethink: on what basis should they trust a third-party package?
II. .pth Hooks: Why "I Didn't Import It" Does Not Constitute a Sense of Security
The "smartest" aspect of this attack, and the one CIOs should remember most, is the execution mechanism.
Malicious code is installed into site-packages in the form of a .pth startup hook. This is a legitimate Python mechanism—the interpreter automatically processes installed .pth files when it starts. The result is: as long as any Python process runs in this environment, the payload will execute, even if that process has nothing to do with agent-framework.
| 版本 | Hook file | Load module | Concealment technique |
|---|---|---|---|
| 1.26.1 | agent_framework_meta.pth | _telemetry.py | Disguised as a telemetry module |
| 1.26.2 | af_runtime_diag.pth | af_runtime_diag.py | Restore the original initialization file, rename and relocate the hook |
1.26.2 Especially noteworthy: the attackers restored Microsoft's original package initialization file and merely renamed the malicious hook. This means checking only by the first version's filename will miss the second version. The payload also sets the _AF_TEL=1 marker, forking a child process detached from its parent process on Linux and starting a thread on Windows—the child process can outlive the process that started it.
One hard rule during investigation: StepSecurity explicitly warns that in affected environments, do not run pip or any Python—once the interpreter starts, the hook may trigger again. The correct approach is to isolate the host, kill residual processes, and rebuild from a clean base, rather than "cleaning in place."
III. What it wants is not your code, but every key you can get your hands on
The target list for this payload is almost a "keychain" for enterprise cloud environments:
- Collect environment variables whose names contain fields such as
TOKEN,SECRET,AZURE,AWS,GITHUB; - Read environment data from up to 300 other processes (under Linux,
/proc), and copy.envfiles; - Scrape the credential files for Azure CLI, pip, npm, Git, Docker, and Hugging Face, as well as the credentials for the Azure DevOps agent;
- What's even more aggressive is actively requesting new tokens: through IMDS / App Service endpoints, request Azure managed identity tokens for up to 12 resources, Azure DevOps pipeline OIDC tokens; version 1.26.2 also added GitHub Actions OIDC tokens.
After all data is compressed and encoded, it is sent via a single HTTPS POST to the attacker-controlled webhook.site endpoint. Elastic Security summed up the crux in one sentence: "These tokens are the way a compromised build can reach the Azure subscription behind it." Wiz added that such tokens can remain valid for up to 24 hours.
Do not treat "the window is only a few tens of minutes" as reassurance.Wiz observed 17 requests in its free-tier webhook logs, corresponding to 3 unique victims successfully exfiltrated—and this is a truncated log, not the total number of victims. More alarming, Wiz judges that the attackers likely obtained the client certificate and private key for Microsoft ESRP's internal signing and publishing service; the GHSA advisory (ID GHSA-764m-3ppc-5m73, also known as OSV MAL-2026-20101) is still unattributed to an attacker, and Microsoft told The Register that it is setting some repositories to private while investigating.
In other words: what was bypassed this time is the "Microsoft signature" layer. For enterprises, this directly overturns an implicit assumption—"the official package from a major vendor has the correct signature, so it can safely go into CI." A signature proves that "this package once came from here," not that "this package has not been poisoned now."
IV. Three Things for CIOs: Manage Agent Frameworks as Production Assets
AI agent development frameworks are entering enterprise environments at an extremely rapid pace. They run on developer machines, and also on CI/CD build machines and cloud runners—the latter often hold the service connections that deploy to production subscriptions. Managing them can no longer follow the mindset of "just installing a development tool."
1. Upgrade from "version locking" to "hash locking + internal artifact gate". In the lockfile, hash-lock 1.26.0, and explicitly block 1.26.1 and 1.26.2 in internal mirrors, Artifactory, and Nexus. Cached copies in mirrors will not automatically disappear just because you delisted the PyPI version.
2. Default to "infection means leak"; perform rotation from a clean machine.Isolate affected hosts and runners; do not run Python in place; rebuild from a known-clean base; then rotate all reachable credentials on clean machines—environment variables, Azure CLI sessions, PATs, service connections, registry tokens, Git credentials, CI/CD secrets—and re-register any exposed self-hosted runners. Rotation does not necessarily revoke already-issued tokens; also review sign-in logs for managed identities and federated credentials.
3. Tighten the token permission surface. Restrict the scope of id-token: write and whitelist the runner's outbound traffic. Whether this attack can obtain a usable Azure token depends precisely on whether these preconditions hold—which is exactly why ordinary developer machines and "high-privilege build agents" must be managed separately.
There is a longer account to settle. When the industry discusses "agent identity," "non-human identity," and "least privilege," this incident reminds us: The software supply chain on which agents depend to operate is itself part of the identity and permission system. You issue an agent an ID badge, yet let it be born from an unverified build environment—no matter how standardized the badge is, it cannot stop someone from copying the key right where it is produced.
Primary Sources and Dates: Security Insider (2026-11-19 incident timeline); FreeBuf / OX Security, StepSecurity, Socket, Wiz, Elastic Security Labs analyses (from 2026-11-17); Inception Security remediation recommendations (2026-11-17); GHSA-764m-3ppc-5m73 / OSV MAL-2026-20101. Figures such as the affected window, download counts, and token scope are based on each organization's original text; the attack entry point and attribution have not yet been publicly confirmed.
This article was compiled by Zhongdi Information for observations on enterprise digitalization and open-source supply chain security, and does not constitute a substitute for security incident emergency response.
