system: OPERATIONAL
← back to all hacks
SUPPLY CHAIN CRITICAL NEW

Microsoft agent-framework on PyPI: two releases shipped a .pth credential stealer

On November 17, 2026, versions 1.26.1 and 1.26.2 of Microsoft's agent-framework Python package carried a startup hook that harvested Azure, CI and LLM API secrets. What happened and how to respond.

2026-11-24 // 6 min affects: microsoft-agent-framework, azure-openai-agents, python-ai-agent-stacks, ci-pipelines

What is this?

On November 17, 2026, two malicious releases of agent-framework, the PyPI package for Microsoft Agent Framework, were published: 1.26.1 at 20:35 UTC and 1.26.2 about 33 minutes later. Both contained a credential stealer. PyPI quarantined and removed them within roughly an hour (JFrog places removal by 21:16 UTC; Wiz reported both unavailable as of 21:30 UTC). The last clean version is 1.26.0, released on November 12.

Wiz Research (Rami McCarthy, Scott Piper, Benjamin Read) published its analysis on November 17 and updated it on November 18. JFrog Security Research and SafeDep published independent write-ups on November 18. The package sees roughly 40,000 downloads a week, and dependency bots such as Renovate opened upgrade pull requests within minutes of the first malicious release, so a short exposure window was still enough to reach CI systems.

This is the second AI-agent library hit with the same technique in two months: in October we covered the LiteLLM 1.107.0 startup-hook stealer.

How it works

The payload does not wait for anyone to import agent_framework. It abuses Python’s .pth files: any .pth file in site-packages is processed when the interpreter starts, and a line beginning with import is executed. That means the code runs every time Python starts in the infected environment, including when you run pip itself.

  • 1.26.1 added a 28-byte agent_framework_meta.pth that imports a module whose _telemetry._start() function forks into a detached session and runs the collector in the background (a daemon thread on Windows). An environment flag prevents re-execution in child processes.
  • 1.26.2 restored the clean module and moved the hook to af_runtime_diag.pth and af_runtime_diag.py, named to look like a “runtime diagnostics” helper.

The collector targets exactly what an AI-agent deployment tends to hold:

  • environment variables whose names match generic or vendor patterns (Azure, AWS, GitHub, OpenAI, Foundry, Hugging Face, package registries, and generic KEY/TOKEN/SECRET, which also catches other LLM API keys);
  • up to 60 credential files (80 in 1.26.2): Azure CLI caches, .npmrc, pip.conf, .netrc, .git-credentials, Docker config, Azure DevOps agent credentials, .env files;
  • secret-looking values from other processes’ environments on Linux;
  • freshly minted Azure managed-identity tokens for a dozen resources, Azure DevOps OIDC tokens, and, in 1.26.2, GitHub Actions OIDC tokens for workflows with id-token: write.

Everything was compressed, base64-encoded and sent in a single unencrypted HTTPS POST to a webhook.site endpoint. Wiz notes the endpoint was on a free tier capped at 100 requests; of 50 captured requests, it counted only three distinct successful victim exfiltrations.

How the release was published is still being clarified. Wiz’s updated analysis says the attacker appears to have obtained a client certificate and private key for Microsoft’s internal release pipeline (ESRP). JFrog observed that the 1.26.1 wheel was repacked locally rather than built by the normal pipeline. SafeDep reports that a new, second maintainer account appeared on the PyPI project on November 17. Wiz says how the credentials were obtained is not yet known, and none of the three sources quotes a public Microsoft statement.

Why it matters

Agent frameworks run in places full of high-value secrets: CI runners with deploy rights, containers with cloud managed identities, developer laptops with LLM API keys. A stealer that mints new cloud tokens, rather than just copying static ones, means that rotating passwords is not enough: issued managed-identity and OIDC-exchanged tokens stay valid for up to 24 hours, and Azure CLI refresh tokens survive a password change unless sessions are revoked.

The episode also shows a structural weakness of fast dependency updates. Automatic upgrade bots and unpinned >= constraints turned a sub-hour window into a real exposure.

Defenses

  1. Find exposure. Search lockfiles, CI logs, virtualenvs and container images built on November 17 for agent-framework 1.26.1 or 1.26.2. Pin to 1.26.0 or a later release confirmed clean by Microsoft.
  2. Check for the hook without starting Python. Look in site-packages for agent_framework_meta.pth or af_runtime_diag.pth. JFrog advises setting the flag the malware uses to skip execution, deleting the artifacts, then uninstalling with the environment’s own interpreter, because bare pip triggers the hook.
  3. Check egress. Search proxy and DNS logs for POSTs to webhook.site with the user agents af-runtime-diagnostics/1 or runtime-diagnostics/1.
  4. Rotate and revoke. Rotate every secret reachable from affected hosts and runners (LLM API keys, registry tokens, git credentials, Azure DevOps PATs and service connections). Revoke Entra ID sessions where Azure CLI caches existed, and review sign-in logs for managed identities and federated credentials.
  5. Harden the pipeline. Lock the full dependency tree with hashes (pip-compile --generate-hashes, uv lock), add a cooldown before bots adopt new releases, restrict id-token: write to jobs that need it, and default-deny CI egress to paste and webhook services.
  6. Scan for .pth files in new releases. A package that suddenly ships a top-level .pth file is a strong signal worth blocking in your registry proxy.

Status

ItemDetail
Packageagent-framework (PyPI)
Malicious versions1.26.1 (Nov 17, 20:35 UTC), 1.26.2 (Nov 17, ~21:08 UTC)
Last clean version1.26.0 (Nov 12, 2026)
RemovedQuarantined/removed by PyPI within about an hour
Mechanism.pth startup hook, background credential collector
Publication pathUnder investigation (release-pipeline certificate per Wiz; new maintainer account per SafeDep)
ReferencesWiz advisory wiz-adv-2026-214; JFrog XRAY-1167986; no CVE assigned at time of writing

Sources