Microsoft's Own Agent-Framework Package on PyPI Was Backdoored — Two Releases, 33 Minutes, 192,534 Monthly Downloads

Microsoft's Own Agent-Framework Package on PyPI Was Backdoored — Two Releases, 33 Minutes, 192,534 Monthly Downloads

Microsoft's Own Agent-Framework Package on PyPI Was Backdoored — Two Releases, 33 Minutes, 192,534 Monthly Downloads

Supply-chain attackers achieved something unusual last week: they compromised the publishing pipeline of an official Microsoft package. Two releases of agent-framework — the meta-package for Microsoft Agent Framework, the company's open-source toolkit for building and orchestrating AI agents — carried a credential-stealing payload. Versions 1.26.1 and 1.26.2 were published on PyPI 33 minutes apart on November 17, 2026, and by November 18 both had been quarantined by the Python Package Index after independent reports from Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity and Wiz. How the attacker obtained publishing access to a Microsoft-maintained project is still unknown. Version 1.26.0 is the last clean release, and with 192,534 monthly downloads by OX's count, the blast radius was potentially wide.

The execution mechanism is the nasty part. Each malicious wheel drops a .pth file into the site-packages root — Python executes import lines in .pth files on every interpreter start, so the stealer runs on any Python launch in the affected environment, "including pip itself, whether or not anything imports Agent Framework," as Endor Labs put it. Version 1.26.1's hook was named agent_framework_meta.pth; in 1.26.2 the attacker restored Microsoft's original initializer and moved the hook to a new file named af_runtime_diag.pth, making the change harder to spot. Both rigged versions kept their dependency on the genuine agent-framework-core 1.26.0, so the framework worked normally while the stealer ran in the background. Notably, the attacker demonstrated continued publishing access by uploading 1.26.2 after 1.26.1 had already been quarantined.

What it steals reads like a cloud-team's nightmare inventory. The payload collects environment variables whose names match substrings like TOKEN, SECRET, AZURE, AWS and GITHUB — reading the environments of up to 300 other processes — and copies credential files for Azure CLI, pip, npm, Git, Docker, Hugging Face and Azure DevOps agents, plus .env and JSON files. Beyond credentials already on disk, it asks cloud platforms to issue new ones: Azure DevOps pipeline federation tokens via SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI, Azure managed-identity tokens from the instance metadata endpoint, and in 1.26.2, GitHub Actions OIDC tokens. Everything is compressed, encoded and exfiltrated to a webhook.site endpoint. "Besides reading credentials already on disk, the code asks the platform to issue new ones," SafeDep noted — "rotating stored secrets does not cover those." StepSecurity cautions the code only attempts these requests and there is no confirmed evidence any tokens were issued.

What Should You Do?

  1. Purge and pin: uninstall agent-framework, remove any agent_framework_meta.pth or af_runtime_diag.pth from site-packages roots (including virtualenvs and containers built since November 17), and reinstall from 1.26.0 or later clean releases. Treat any CI/CD runner or developer machine that installed 1.26.1/1.26.2 as compromised.
  2. Rotate everything the environment could have held: cloud keys, pipeline tokens, registry credentials, Git credentials — and because the payload requested fresh federation and managed-identity tokens, review token issuance logs, not just static secret stores.
  3. Check for egress to the webhook.site endpoint in proxy, DNS and firewall logs going back to November 17 — a single POST is the entire exfil event, so look for one-time anomalies, not sustained traffic.
  4. Rebuild, don't clean, shared runners. A .pth hook that executes on every Python start survives casual removal; redeploy runner images from known-good builds.

The WAF Angle

Package-manager compromise is the attack class where an inbound WAF has nothing to say — the malicious code arrives through your build process, signed as a legitimate dependency, and never crosses the web edge. That is why the WAF-adjacent lesson here is about outbound traffic: the stealer's entire life cycle ends in one request to a public webhook endpoint, and that request crosses a network boundary you control. Egress allow-listing for CI runners and dev machines — the same deny-by-default posture the poisoned cPGuard update and the wfx-loot CI campaign already argued for — turns a total dependency compromise into a contained one. And the demand for fresh OIDC and managed-identity tokens repeats the trojanized Claude Code extension pattern with a sharper edge: your build system that can mint cloud tokens is a credential, and it needs the same egress and token-scope discipline as your secrets.

Sources