Microsoft Agent-Framework PyPI Hijack Steals Keys (2026)
The Microsoft agent-framework PyPI hijack began on November 17, 2026, when two malicious versions of Microsoft’s agent-framework package appeared on PyPI carrying a credential stealer that ran every time Python started. Versions 1.26.1 and 1.26.2 were live for less than an hour before PyPI quarantined them, but the window was long enough for automated dependency bots to start opening upgrade pull requests in downstream repositories within six minutes. Anyone who installed either version must now assume their cloud credentials are compromised.
The incident matters because of what was attacked and how. The target was not a obscure library but the official Python package for Microsoft’s agent framework, a meta-package with roughly 190,000 monthly downloads that sits at the center of the company’s push into AI agents. The attack did not breach Microsoft’s build pipeline or change a line of the framework’s code. Instead, the attacker repacked the package locally, slipped in a startup hook, and published it through PyPI as if it were a routine release. It is a textbook supply-chain attack, and it landed in the week Microsoft’s agent tools went mainstream.

| Time (UTC, Nov 17) | What happened |
|---|---|
| 20:26 | Attacker repacks the wheel locally, nine minutes before upload |
| 20:35 | Malicious version 1.26.1 published to PyPI |
| 20:54 | Upwind reports the issue on Microsoft’s GitHub tracker |
| 21:06 | PyPI quarantines version 1.26.1 |
| 21:08 | Malicious version 1.26.2 published, with the payload relocated |
| 21:16–21:20 | Both versions removed; 1.26.0 restored as the latest release |
Table of Contents
How the Microsoft Agent-Framework PyPI Hijack Worked
The attack was entirely in the packaging. The agent-framework package on PyPI is a meta-package recommended in Microsoft’s quick-install instructions. It contains almost no code of its own: the real SDK lives in agent-framework-core, while the meta-package installs a small stub module that only exposes the version number and pins the core dependency. Because applications import the core namespace and never import the stub, hiding malicious code inside the stub alone would never execute in normal workloads.
The attacker solved that problem with a Python .pth startup hook. Version 1.26.1 added a 28-byte file, agent_framework_meta.pth, to the top of site-packages containing a single import line. Python’s startup loader executes every .pth line before user code runs, so the hook fired on every interpreter launch — even if the developer’s code never imported Agent Framework at all. The hook loaded a disguised telemetry module that forked a detached background process and silently harvested credentials. Version 1.26.2, published two minutes after the first was quarantined, restored the legitimate stub file byte-for-byte to evade diff-based detection and moved the payload to a new module, af_runtime_diag.
What the Malware Stole
The collector was thorough. It scanned environment variables matching sensitive substrings such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI, and HF_, in the current process and in up to 300 other processes visible through the /proc filesystem. It read up to 60 credential files, including Azure CLI data, .npmrc, Docker configuration, .env files, and Azure DevOps agent credentials. And it actively requested fresh tokens rather than only copying stored secrets: Azure managed-identity tokens for twelve Azure resources, Azure DevOps access tokens and OIDC tokens, and, in version 1.26.2, GitHub Actions OIDC tokens for workflows with identity-token write permissions.
Everything it collected was compressed, base64-encoded, and posted as JSON to a webhook.site URL. JFrog’s sandbox runs confirmed the collector writes no lockfiles or markers to disk, so every independent Python launch in an affected environment ran the collection again. The payload was disguised as diagnostic telemetry, complete with an af-runtime-diagnostics user-agent string, which is why it could sit unnoticed on a machine that looked healthy.
How Researchers Proved It Was Not Microsoft’s Release
The Microsoft agent-framework PyPI hijack was a packaging attack, not a breach of Microsoft’s build pipeline, and the forensic evidence is unusually clear. ZIP headers confirm the 1.26.1 wheel came from a local script rather than Microsoft’s Azure DevOps release pipeline: although the archive still claimed to be generated by the standard build tool, the compression headers showed it was repacked at 20:26:19 UTC on November 17, nine minutes before upload, on a host with a UTC+8 clock. Microsoft’s last verified release, python-1.26.0, was published on GitHub on November 13, 2026, and there is no 1.26.1 tag in the repository at all.
The version numbers tell the same story. The malicious 1.26.1 was a wheel-only release that still pinned the legitimate agent-framework-core at 1.26.0, so the framework kept working without errors while the hook ran in the background. The dependency agent-framework-core and 22 other sibling packages were checked and are not affected. No CVE has been assigned to the incident, which is common for supply-chain compromises that are caught and removed quickly — but the absence of a CVE does not mean the absence of victims.

“If you installed either version on a workstation, CI/CD runner, or container image, you must assume your environment and accessible cloud credentials are compromised.”
— JFrog Security Research, Microsoft’s agent-framework Hijacked on PyPI via Silent .pth Startup Hook
What to Do If You Installed It
The remediation advice from researchers is blunt and unanimous. First, pin agent-framework to 1.26.0, the last clean version, and check every environment that may have installed 1.26.1 or 1.26.2 — workstations, CI/CD runners, and container images alike. Second, rotate every credential that could have been visible to the collector: cloud identity tokens, API keys, and CI secrets, including tokens the malware may have requested fresh rather than copied. Third, audit downstream repositories for upgrade pull requests opened by automation in the minutes after the malicious releases landed, since those are the fastest route the attack had into production systems.
The incident also carries a lesson for how teams consume AI agent frameworks. Microsoft’s agent tooling has become central to enterprise AI work — the same week, the company launched MAI Code 2, its enterprise coding model, at its Ignite conference — and the more central a package becomes, the more valuable it is as a supply-chain target. The .pth hook technique is not new, but its effectiveness here shows that the trust model for package registries still assumes publishers are who they claim to be, and that assumption failed for 45 minutes on November 17.
The Bigger Picture
The hijack landed in a week when AI security dominated the news. The same week, the FBI and AWS warned that attackers are using AI agents to automate cybercrime at industrial scale, and the European Commission confirmed it had been hit by an AI-assisted attack using the ARTEX penetration-testing framework. Together, the three stories describe a single shift: AI tooling is now both the target and the weapon, and the infrastructure around it — package registries, agent frameworks, and the credentials they touch — is part of the attack surface.
For developers, the practical takeaway is narrower and more urgent. A package install is a trust decision, and a version number is not proof of provenance. Pin your dependencies, verify releases against the project’s own repository, and treat any credential that lived in an environment with an unknown package as exposed. The PyPI hijack was caught fast. The next one may not be.
FAQ
Which versions of agent-framework were malicious?
Versions 1.26.1 and 1.26.2 of the agent-framework package on PyPI, both published on November 17, 2026. The last clean version is 1.26.0. The core package agent-framework-core and 22 sibling packages were not affected.
Do I need to have imported the package to be affected?
No. The malware used a Python .pth startup hook that executes on every Python interpreter launch, even if your code never imports agent_framework. Any Python invocation in an affected environment triggered the credential collector.
What credentials should I rotate?
Assume everything visible to the environment is exposed: cloud identity tokens, API keys, and CI/CD secrets, including Azure managed-identity tokens, Azure DevOps tokens, and GitHub Actions OIDC tokens. Pin agent-framework to 1.26.0 and audit environments that installed the malicious versions.
Verdict
The Microsoft agent-framework PyPI hijack will be remembered as a near-miss that still demands action. The malicious versions were live for under an hour, PyPI quarantined them quickly, and Microsoft’s own code was never touched — but the attack reached one of the most downloaded AI agent packages in the Python ecosystem, harvested credentials silently, and proved that a repacked wheel can pass as an official release. For anyone building with AI agents, the lesson is simple: the supply chain is part of your security perimeter now, and a 45-minute window is all an attacker needs.



