Supply Chain

Microsoft agent-framework supply chain attack: how two PyPI releases stole Azure and CI credentials

Microsoft agent-framework hack explained: compromised PyPI releases 1.26.1 and 1.26.2 hid a credential stealer for Azure and CI tokens. How to check exposure.

By · · 5 min read

The Microsoft agent-framework supply chain attack put a credential stealer inside the official PyPI package for Microsoft Agent Framework, Microsoft’s open-source framework for building and orchestrating AI agents in Python. On 17 November 2026, two malicious versions, 1.26.1 and 1.26.2, were published 33 minutes apart. Wiz puts the package at about 41,000 downloads a week, and The Hacker News at about 190,000 a month.

PyPI quarantined both releases the same evening. The last clean version is 1.26.0, released on 12 November. How the attacker obtained publishing access has not been confirmed.

What happened

agent-framework is a thin meta-package. StepSecurity explains that its wheel contains a single agent_framework_meta/__init__.py that pulls in the component packages, such as agent-framework-core, that do the real work.

The malicious wheels did not change that dependency list. They added a .pth file to site-packages, and that was enough. Python runs import lines in .pth files every time the interpreter starts, so the stealer ran on any Python launch in the environment, including pip itself, whether or not anything imported Agent Framework.

Wiz found no python-1.26.1 tag or release in the microsoft/agent-framework repository, and the main branch does not contain the malicious code. Legitimate releases ship a wheel and a source distribution together with a matching agent-framework-core. The malicious versions were wheels only and still depended on agent-framework-core[all]==1.26.0. Wiz concludes they may have been built outside the normal release process and uploaded directly.

The attack chain, step by step

Based on StepSecurity’s and Wiz’s timelines (all times UTC, 17 November):

  1. Publishing access. StepSecurity’s timeline notes that a maintainer account, vibiret, was created and added to the project that day. It also stresses that the evidence does not establish the initial access vector or which credential was used. Both uploads carried the user-agent RestSharp/106.13.0.0 and no provenance attestation.
  2. First release. At 20:35:20, version 1.26.1 was uploaded with agent_framework_meta.pth, a new _telemetry.py module and eight lines appended to __init__.py to start it.
  3. Execution on the next Python start. Installing runs nothing. The next interpreter start processes the .pth hook, which forks, detaches with setsid() and collects in the background. Where fork is unavailable it falls back to a daemon thread.
  4. Collection. The payload reads environment variables whose names contain strings such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI and HF_, scrapes up to 300 /proc/*/environ files from other processes, and reads credential files: Azure CLI caches, .npmrc, pip.conf, .netrc, .git-credentials, Docker config.json, Hugging Face tokens, Azure DevOps agent .credentials and .env files.
  5. Minting new tokens. With SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI set, it requests Azure DevOps OIDC tokens for api://AzureADTokenExchange. On Azure compute it asks the managed identity endpoint or IMDS for tokens to 12 resources, including Azure management, Microsoft Graph, Key Vault and Storage.
  6. Exfiltration. Everything goes into one JSON document, zlib-compressed, Base64-encoded and sent in a single HTTPS POST to a hard-coded webhook[.]site URL. There is no retry and no second-stage download.
  7. Quarantine and a second try. PyPI quarantined 1.26.1 at 21:06:16. At 21:08:39, 2 minutes 23 seconds later, the attacker uploaded 1.26.2. It restored __init__.py to the clean file, moved the hook to af_runtime_diag.pth and af_runtime_diag.py, and added GitHub Actions OIDC token requests. It was quarantined at 21:16:44.

Why it worked

Install-time scanning misses startup hooks. Nothing ran during pip install. The code ran later, from any Python process, which decouples execution from the package being used at all.

The publisher was trusted, not verified. Consumers pinned to “Microsoft’s official package” got whatever was uploaded to that name. Wiz notes the malicious wheels broke the usual release pattern, with no source distribution and no matching core release, and StepSecurity found no provenance attestation.

CI runners hold live identity. The payload did not just copy stored secrets. As SafeDep, quoted by The Hacker News, puts it: “Besides reading credentials already on disk, the code asks the platform to issue new ones.” StepSecurity warns that rotating static secrets does not necessarily invalidate tokens already issued.

Quarantine did not revoke access. The second upload after the first quarantine shows the attacker still held publishing rights.

What defenders should do

  • Pin exact versions with hashes in lock files and avoid floating installs of fast-moving AI SDKs in CI.
  • Add a cooldown before new upstream releases reach builds, so a version quarantined within an hour never arrives.
  • Check provenance where the ecosystem offers it, and alert when a release lacks the attestation or sdist that earlier releases had.
  • Scope CI identity tightly: grant id-token: write only to jobs that deploy, keep federated credentials narrow, and give managed identities least privilege.
  • Restrict runner egress. A build job has no reason to POST to a public request-capture service.

How to check if you are affected

  • Versions: search lock files, images, caches and pip freeze output for agent-framework==1.26.1 or 1.26.2. The exposure window was roughly 20:35 to 21:20 UTC on 17 November.
  • Files: look in site-packages for agent_framework_meta.pth, agent_framework_meta/_telemetry.py, af_runtime_diag.pth or af_runtime_diag.py. Socket lists SHA-256 hashes for both wheels and every payload file.
  • Network: search proxy and DNS logs for webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb and the user-agents runtime-diagnostics/1 and af-runtime-diagnostics/1. StepSecurity notes a connection alone does not confirm a successful transfer.
  • If installed: isolate the host or runner before starting Python or pip again, rebuild from a clean base pinned to 1.26.0, rotate every credential the payload could read or request from a clean system, and review Azure sign-in and activity logs and GitHub Actions workflows that deploy to Azure.

My take

This is the pattern I described in the Cursor supply chain breach: attackers are going after the AI developer toolchain because that is where cloud credentials and build identity sit together. An agent framework is installed in exactly the places with the most reach, CI runners and Azure workloads.

What stands out to me is the token minting. Many incident playbooks still say “rotate the secrets”. Here the stealer asked the platform for fresh tokens, so containment means reviewing federated trusts, role assignments and identity logs, not just a password reset. For more cases where a trusted dependency became the attack path, see the supply chain category.

Three questions for this week: do our builds install a new upstream release within minutes of publication, which CI jobs can mint cloud tokens without needing to, and would we notice a build step talking to a public webhook service?

Sources

  1. Microsoft agent-framework PyPI Package Compromised · StepSecurity, 18 November 2026
  2. Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines · Wiz, 17 November 2026
  3. Microsoft's agent-framework PyPI package Compromised with Credential Stealer · Socket, 17 November 2026
  4. Attackers Compromise Microsoft's Agent Framework PyPI Package to Steal Cloud Credentials · The Hacker News, 18 November 2026