Research · AI security · Supply chain · AI agents
Microsoft's agent-framework on PyPI: the .pth file that stole cloud keys
Two poisoned releases of Microsoft's agent-framework hit PyPI on 17 November 2026. How the .pth startup hook works, what it took, who was hit and what to check.
Short answer
On 17 November 2026, versions 1.26.1 and 1.26.2 of agent-framework, Microsoft's Python SDK for building AI agents, were published to PyPI with a credential stealer inside. A .pth file runs it every time Python starts in that environment, even if nothing imports the package. It collects environment variables, credential files and Azure and CI tokens and sends them to a webhook.site address. Version 1.26.0 is the last clean release. If either bad version was installed, delete its files without starting Python, rotate every secret that environment could reach, and rebuild.
Two releases of agent-framework, Microsoft’s Python SDK for building AI agents, went up on PyPI on 17 November 2026 with a credential stealer inside. Versions 1.26.1 and 1.26.2 run it every time Python starts in the environment where they’re installed, whether or not your code imports the package. If either one was installed on a laptop, a build runner or a container you own, treat every secret that environment could read as stolen.
Version 1.26.0, published on 12 November, is the last clean release.
This note is built from the researchers’ own write-ups: Endor Labs, Chainguard, Wiz, JFrog and Socket. The reports we read on 20 November carry no explanation from Microsoft of how it happened.
What happened
Version 1.26.1 was published at 20:35 UTC on 17 November. PyPI quarantined it. The attacker still had publishing rights and uploaded 1.26.2 at 21:08 UTC, 33 minutes after the first. Wiz says both versions were no longer available on PyPI as of 21:30 UTC.
So the bad releases were live for under an hour. That was long enough. JFrog saw dependency bots such as Renovate opening upgrade pull requests within six minutes of 1.26.1 landing, and Endor Labs puts the package at about 190,000 downloads a month.
Both uploads were wheels only, with no source distribution, and Chainguard notes that the GitHub source is not reported as modified. The poison was in the published package, so reading the repository would have shown you nothing.
The incident in four numbers
How a .pth file runs code you never imported
A .pth file is a small text file in Python’s site-packages folder. Its normal job is to add folders to the import path. The Python documentation describes one more thing it can do: “For backward compatibility, lines starting with import (followed by space or tab) are executed with exec().” That happens at interpreter startup, before your script runs.
The attacker shipped a .pth file with one such line. In 1.26.2 the file is 23 bytes long, per Chainguard.
From then on, anything that starts Python in that environment starts the stealer: pip, pytest, your editor’s language server, a cron job. Installing the wheel doesn’t run the code. The next Python command does.
Python 3.15 deprecated import lines in .pth files, but the same page says they are still executed during the deprecation period. Upgrading Python is not the fix today.
From pip install to stolen tokens
What it took
The collector is aimed at cloud and build credentials. Across the write-ups, it gathers:
- environment variables whose names look like secrets (Endor Labs and JFrog count 31 name patterns in 1.26.1), which sweeps up model provider API keys along with cloud ones
- on Linux, the environments of other processes, up to 300
/proc/*/environentries - credential files under 256 KB each, up to 60 in 1.26.1 and 80 in 1.26.2: Azure CLI files,
.npmrc,.netrc,.git-credentials, Docker config,pip.conf, Hugging Face tokens - Azure managed identity tokens, requested from the instance metadata service at
169.254.169.254 - an Azure DevOps OIDC token when the pipeline exposes one, and in 1.26.2 a GitHub Actions OIDC token as well
The last two matter most on build runners. An OIDC token is how your pipeline proves who it is to Azure, so the stealer was asking for the pipeline’s identity as well as reading files.
Everything is packed into one JSON document, compressed, base64-encoded and sent in a single HTTPS POST to a webhook.site URL. Chainguard, JFrog and Socket all report no second-stage download, and JFrog found no persistence outside site-packages. Remove the files and the stealer is gone. The credentials it already sent are not.
Who was hit
Wiz analyzed the requests that reached the attacker’s webhook.site endpoint. It counted 50. Four came from the attacker’s own machines, 29 appear linked to sandboxes, vendor scanning and tests, and the other 17 came from what Wiz calls “only three unique, successful cases of exfiltration of victim data.”
The 50 requests the attacker's endpoint captured
- 17 from victims (three unique cases)
- 29 that appear linked to sandboxes, vendor scanning and tests
- 4 from the attacker's own machines
Three is a small number, and I wouldn’t lean on it. If the package was installed in your environment during that window, you can’t tell from the outside whether you’re one of the three, and rotating is cheaper than guessing.
How the attacker published under Microsoft’s name
That part is still open. SecurityWeek reported on 18 November that the method remained unknown. Wiz’s reading, added the same day, is that the attacker “appears to have compromised a client certificate and private key” for Microsoft ESRP (Engineering System Release Pipeline), and it adds that how those credentials were obtained is not yet known. Endor Labs says only that the uploads came from an account or token with publishing rights to the package.
That is why checking the package name would not have saved you. It was the real package, from the real publisher.
What to do this week
- Search for the two versions. Look in lockfiles, requirements files, CI logs, pip caches and any container image built after 20:35 UTC on 17 November for
agent-framework1.26.1 or 1.26.2. - If you find one, don’t run
pythonorpipthere. Each start runs the stealer again, andpip uninstallis a Python start. Isolate the machine or runner, then delete the files with shell tools:agent_framework_meta.pthand_telemetry.pyfor 1.26.1,af_runtime_diag.pthandaf_runtime_diag.pyfor 1.26.2. Rebuilding the environment from scratch is better. - Rotate every secret that environment could read or request: Azure identities and federated credentials, Azure DevOps and GitHub tokens, registry tokens, model provider API keys, anything in
.envfiles. Then read the audit logs from the install time onward. Our note on what attackers do with a leaked AWS key covers the same job on AWS. - Check egress logs for POSTs to
webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bband for the user agentsaf-runtime-diagnostics/1andruntime-diagnostics/1. Match the full path. webhook.site itself is a legitimate service. - Pin
agent-framework==1.26.0with hashes (pip install --require-hashes) until Microsoft names a clean newer version.
Two habits would have blunted this one. Set a minimum release age in your dependency bot, so a version that is minutes old never reaches a pull request. And in GitHub Actions, give id-token: write only to the jobs that need it, so a poisoned dependency in a test job can’t ask for a cloud token.
An agent framework is a good target for a stealer because of where it gets installed: next to model provider keys, cloud identities and pipeline tokens. The Cursor breach reached developer machines through an editor extension. This one came through pip install.
Sources (all checked 20 November 2026)
- Endor Labs, “agent-framework compromised: Python startup hooks steal Azure and CI credentials”, 17 Nov 2026: endorlabs.com
- Chainguard, “Microsoft agent-framework compromised on PyPI”, 17 Nov 2026: chainguard.dev
- Wiz, “Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines”, 17 Nov 2026, updated 18 Nov: wiz.io
- JFrog Security Research, “Microsoft’s agent-framework Hijacked on PyPI via Silent .pth Startup Hook”, 18 Nov 2026: research.jfrog.com
- Socket, “Microsoft’s agent-framework PyPI package Compromised with Credential Stealer”, 17 Nov 2026: socket.dev
- SecurityWeek, “Microsoft Agent Framework Releases Poisoned With Credential Stealer”, 18 Nov 2026: securityweek.com
- Python documentation,
sitemodule (path configuration files): docs.python.org