What happened

On 17 November (UTC), someone published two releases of Microsoft's agent-framework package to PyPI that contained a credential stealer. PyPI describes the package as the Microsoft Agent Framework for building AI agents with Python, and SafeDep puts its downloads at about 192,000 a month. Version 1.26.1 went up at 20:35 UTC. After PyPI quarantined 1.26.1 at 21:06, the attacker uploaded 1.26.2 two minutes and 23 seconds later, and PyPI quarantined that one at 21:16. In Auckland that window ran from 9:35am to 10:16am on Wednesday 18 November, which is when CI pipelines and laptops here are busiest.

The last clean release is 1.26.0, published on 12 November, and the PyPI page lists 1.26.0 as the latest version again. Endor Labs checked 22 sibling agent-framework-* packages, including agent-framework-core, and none of them had a release after 12 November. Both bad wheels pinned agent-framework-core[all]==1.26.0, so the rest of the framework installed normally and nothing looked broken.

How the payload worked

Python runs any .pth file it finds in site-packages each time the interpreter starts. The 1.26.1 wheel added a 23-byte .pth file that imported a module disguised as telemetry, so the stealer ran on every Python start in that environment, whether or not the code ever imported agent_framework. That covers pip, pytest and IDE language servers. Version 1.26.2 moved the payload to differently named files and restored the legitimate __init__.py, so a check of that one file would miss the newer variant.

The collector read environment variables with names containing strings such as TOKEN, SECRET, KEY, AZURE, GITHUB and OPENAI. It picked up credential files for the Azure CLI, pip, npm, Git, Docker and Hugging Face, plus .env files. On Linux it also read other processes' environments through /proc/*/environ. Chainguard's analysis says the collector requested fresh Azure managed identity tokens for nine resource types, Key Vault and Cognitive Services among them. Version 1.26.2 added GitHub Actions OIDC tokens. OIDC (OpenID Connect) is the short-lived identity token a workflow trades for cloud access, and Wiz says the stealer could grab one from any workflow with id-token: write. All of the data went out in a single HTTPS POST to a webhook.site URL. The payload didn't download a second stage or set up persistence, so deleting the files stops the stealer, although anything already sent stays compromised.

How much leaked, and how the attacker got in

Wiz watched the exfiltration endpoint and found that the webhook.site free tier captured at most 50 requests. Among those, Wiz counted three unique successful exfiltration cases that may contain working credentials. Nobody outside PyPI and Microsoft knows how many installs happened. JFrog reports that Renovate opened upgrade pull requests within six minutes of 1.26.1 landing, which shows how quickly automated dependency bots pull in whatever arrives.

The root cause isn't settled. StepSecurity and SafeDep both point to a maintainer account called vibiret, which joined PyPI on 17 November. Both wheels carried the uploader user-agent RestSharp/106.13.0.0 and had no provenance attestation, unlike the clean 1.26.0. Wiz updated its post on 18 November to say the attacker appears to have compromised a client certificate and private key for Microsoft's internal ESRP signing and publishing service, and how those credentials were obtained is still unknown. As of 20 November we couldn't find a Microsoft advisory, and the GitHub issue that security vendors linked to now returns a 404. JFrog makes a point for anyone who relies on quarantine: "Quarantining a single version on PyPI does not revoke the compromised publishing credential."

What to check if you build agents in Python

Anyone who ran an unpinned pip install agent-framework after 20:35 UTC on 17 November may have pulled 1.26.2. Container images built that morning NZ time count too. Every vendor gives the same warning: don't start Python or pip in a suspect environment, because each interpreter start runs the collector again. A plain pip uninstall triggers the collector as well. The steps below come from the Chainguard, StepSecurity and Endor Labs write-ups:

  1. Use shell tools to search lockfiles, requirements files, CI logs and pip caches for 1.26.1 or 1.26.2.
  2. Look in site-packages for agent_framework_meta.pth, agent_framework_meta/_telemetry.py, af_runtime_diag.pth and af_runtime_diag.py.
  3. Search proxy and DNS logs for the webhook.site UUID path and the runtime-diagnostics/1 user-agent.
  4. Isolate the affected host or runner and rebuild it from a clean base, pinned to agent-framework==1.26.0.
  5. From a clean machine, rotate every secret the environment could read: model provider keys, Azure service principals, Azure DevOps tokens, registry tokens and anything in .env.
  6. Review GitHub OIDC federated credentials and Azure activity logs. Wiz notes that stolen tokens may stay valid for up to 24 hours, and removing a trust doesn't necessarily revoke tokens already issued.

JFrog adds that uv doesn't run .pth hooks, so uv pip uninstall is a safer way to remove the package than pip.

Changes worth keeping afterwards

Agent projects carry more secrets than most codebases. A typical agent repo holds model API keys, cloud identities for tools and CI tokens for evaluation runs, and the attacker's target list matched that profile closely. Two cheap controls would have blocked this attack for most teams.

pip's hash-checking mode stores a --hash for every requirement and refuses anything that doesn't match. Every package must be pinned with ==, and the pip documentation pairs --require-hashes with --only-binary :all: for a stricter install. A hash-pinned lockfile would never have resolved to 1.26.1 or 1.26.2.

A release cooldown holds back new versions until they've aged. uv's exclude-newer setting accepts durations such as 1 week or 30 days and ignores any distribution uploaded more recently. A separate exclude-newer-package setting lets a team exempt a package when it needs an urgent fix. Both malicious releases were gone from PyPI within about an hour, so even a one-day cooldown would have skipped them. Chainguard noted that its customers with cooldown policies had a second layer of protection.

Endor Labs also suggests alerting on new .pth files in third-party wheels, treating a wheel-only release as a warning sign and giving CI identities tightly scoped permissions. For NZ teams that run agents on Azure, managed identities need the same scoping: a build runner that can mint Key Vault and Cognitive Services tokens gives a stealer like this everything it wants. If your team builds a hash-pinning or cooldown setup that others could reuse, we'd welcome it on the ASAI projects page.

Sources

Build with people working on the same things

Join the Auckland Society for AI: NZ$599 a year with a ForgeBox and the members' projects area. Our Auckland meetups are open to everyone.

Become a member