agent-framework on PyPI: two releases that stole credentials on every Python start
For about 40 minutes, agent-framework on PyPI shipped a credential stealer that ran at every Python start. Who is exposed, how to clean up, what to change.
For about forty minutes on the evening of 17 November 2026, anyone who installed the latest agent-framework from PyPI got a credential stealer with it. Versions 1.26.1 and 1.26.2 of the meta-package for Microsoft's Agent Framework, a framework for building AI agents, added a .pth startup hook that ran on every Python start, read tokens and credential files, and posted them to a public webhook. Both versions are gone from PyPI, but anything that installed them in that window, including laptops, CI runners and container images, should be treated as exposed.
What happened
The GitHub advisory GHSA-764m-3ppc-5m73, rated critical and typed as malware, gives the timeline: 1.26.1 was published at 20:35 UTC as a wheel only, and 1.26.2 at 21:08 UTC. The last clean release is 1.26.0, and earlier versions are not affected.
Elastic Security Labs says its monitor flagged 1.26.1 at 20:41 UTC, six minutes after it appeared. JFrog's analysis adds that PyPI quarantined 1.26.1 at 21:06 UTC, the attacker uploaded 1.26.2 two minutes later, and both were removed by 21:16 UTC. JFrog also observed that dependency bots were already opening upgrade pull requests in downstream repositories within six minutes of the first upload.
JFrog's reading of the archive is that the malicious wheels were repacked locally rather than built by Microsoft's release pipeline. Neither JFrog nor the advisory attributes the attack to a known group, and none of the sources we read explains how the attacker obtained the right to publish.
How much it was used
The sources describe reach differently. Elastic says the package "averages 196,000 downloads a month across all versions"; JFrog says "roughly 40,000 weekly downloads". These are different measures over different periods, and both cover all versions, not the two malicious ones. Neither tells you how many installs happened during the forty minutes that mattered.
How the stealer ran
agent-framework is a thin meta-package: applications import agent_framework, which comes from agent-framework-core, so code hidden in the meta-package's own module would normally never run. The attacker worked around that with a .pth file. Python's site module reads every .pth file in site-packages at interpreter start, and executes any line that begins with import. The advisory sums up the consequence: the code "executes as soon as the package is installed, without importing agent_framework". Strictly, it runs at the next Python start after installation, which in practice is almost immediate: pytest, a language server in the editor, a container entrypoint or pip itself.
The dependency pin on agent-framework-core[all]==1.26.0 was left unchanged, so applications kept working and nothing looked broken.
According to the three write-ups, the helper process:
- detaches from the parent, so the command that triggered it shows no delay;
- collects environment variables whose names contain strings such as
TOKEN,SECRET,KEY,AZURE,GITHUBandOPENAI, and, on Linux, the environments of other running processes; - reads credential files: Azure CLI token caches,
.npmrc,.netrc,.git-credentials, Docker configuration, Hugging Face tokens, Azure DevOps agent credentials and.envfiles in some container paths; - asks the Azure instance metadata service, or the App Service identity endpoint, for managed-identity tokens;
- in 1.26.2, also requests GitHub Actions OIDC tokens.
JFrog notes that broad matches such as KEY also pick up other providers' model API keys present in the environment. Everything is compressed, Base64-encoded and sent in one request.
Where the analyses differ
On the Azure DevOps OIDC request, Elastic says it is "unclear" whether it returns a usable token, because a parameter Microsoft's documented flow uses is missing. JFrog goes further and says real endpoints reject it. Both agree that a pipeline's SYSTEM_ACCESSTOKEN still leaks if it is mapped into the environment. JFrog also points out that most file paths are Linux paths, so macOS machines lose fewer files, but still lose environment variables and Azure token caches.
Analysis: an agent framework is a good place to steal from
This is a supply chain attack with an ordinary mechanism, but the target is telling. Agent frameworks sit where model keys, cloud identities and CI credentials meet: an agent project's environment typically holds a model provider key, a cloud identity for its tools and a pipeline token to deploy it. The stealer's list of strings reads like an inventory of exactly that.
Three details deserve attention beyond this incident.
- Installing is enough. Code review of your own repository would not catch this: nobody imports the malicious module. The
.pthmechanism means the only safe assumption is that installation equals execution. - Removing it can run it again. JFrog warns against a plain
pip uninstallin an infected environment, becausepipis a Python program and starts by processing.pthfiles. Its guidance is to set_AF_TEL=1first, which the stealer checks to avoid running twice, then delete the hook files with the environment's own Python. - Short-lived tokens are not a full answer. Managed-identity and OIDC tokens have no static secret to rotate. JFrog notes they stay valid until they expire, up to 24 hours, so the response is to review sign-in logs and narrow role assignments, not only to rotate.
The detection was fast, and that is the encouraging part: six minutes to a public warning, under an hour to removal. The bots opening upgrade pull requests were faster still.
What it means for engineering and security leaders
The exposure question is narrow and answerable: did any environment resolve agent-framework to 1.26.1 or 1.26.2 on 17 November? Lockfiles, CI logs, internal package mirrors and container images built that evening will tell you. The harder question is what those environments could reach, because that is the blast radius.
Teams that build agents should treat the agent project's environment as a high-value secret store and scope it accordingly: one model key per project with spending limits, cloud identities limited to the resources the agent needs, and pipeline tokens that are not exposed to every step. An earlier article on shrinking an agent's credential blast radius covers patterns that apply here, and the LiteLLM release pipeline compromise is a reminder that AI infrastructure packages are a recurring target.
Practical takeaways
- Search for the versions. Check lockfiles, mirrors, CI logs and images for
agent-framework1.26.1 or 1.26.2, and searchsite-packagesforagent_framework_meta.pthoraf_runtime_diag.pth. - Clean up without triggering it. Follow JFrog's order: set
_AF_TEL=1, remove the hook files, then uninstall and pinagent-framework==1.26.0. Rebuild affected hosts and images from a clean state where you can. - Rotate what was reachable. Model provider keys, cloud and registry credentials, Git credentials and CI secrets on any affected host, and review cloud sign-in logs for tokens that can't be rotated.
- Check network logs. Elastic and JFrog list the exfiltration endpoint on
webhook.siteand the user agentsaf-runtime-diagnostics/1andruntime-diagnostics/1. - Add a minimum release age to dependency update bots and internal mirrors, so a version has to exist for a while before it is installed automatically. This attack was removed within the hour.