New user dealGet a quick pentest for $100.89 $10.89. New user deal.Claim it →
← All tech posts

Microsoft's AI Agent Framework Got Hijacked on PyPI. You Didn't Even Have to Import It

On November 17, 2026, someone published two malicious versions of Microsoft's agent-framework package to PyPI, 33 minutes apart. Installing either one was enough. You did not need to import the library, run an agent, or even open a notebook. Every time Python started in that environment, a credential stealer started with it.

That detail is the story. The AI agent boom has everyone pip-installing orchestration frameworks into environments that hold cloud credentials, and Python's startup machinery makes it easy to hide inside them.

What happened

According to The Hacker News, threat actors compromised the agent-framework package, the meta-package for Microsoft Agent Framework, an open-source framework for building and orchestrating AI agents in Python. The malicious versions were 1.26.1 and 1.26.2, published on November 17, 2026, and both have since been quarantined on PyPI. The same report says it is unclear how the attacker obtained publishing access, and that the package sees about 190,000 downloads a month.

The Hacker News lists reports from Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity and Wiz. The exposure window it gives is roughly 8:35 to 9:20 p.m. UTC that day.

The trick: .pth files

Python has a little-known feature. When the interpreter starts, it scans site-packages for files ending in .pth. Most contain plain directory paths. But any line that begins with import is executed as code. So a package that drops a .pth file into the site-packages root gets code execution on every interpreter start, whether or not the package is ever imported.

Socket's analysis describes how each version used it:

  • 1.26.1 installed agent_framework_meta.pth. On startup it imported a module that launched collection in a background process or thread.
  • 1.26.2 used af_runtime_diag.pth, replacing the original hook with a single line that imports a relocated payload, and added GitHub-focused targeting.

Socket reports the code gathers credential-related environment variables, local config and credential files, and the environments of other processes. It also requests cloud and workflow identity tokens: Azure in both versions, and GitHub Actions OIDC in 1.26.2. The results are compressed, Base64-encoded and POSTed to a webhook.site endpoint.

Why AI agent stacks make this worse

This is a standard software supply chain attack. Three things about agent development raise the stakes.

Agent environments are credential-rich. A developer building an agent usually has cloud keys, model API keys, database strings and tool tokens in the environment. That is exactly what the stealer targets.

CI runners get the same packages. The reported GitHub Actions OIDC theft is relevant because workflows that deploy to Azure can mint tokens the attacker can then reuse. The Hacker News advice includes auditing GitHub Actions workflows that deploy to Azure.

New frameworks update fast. Teams track the latest release of agent libraries to get features. Unpinned installs pick up a bad version within minutes.

Did the usual defenses work?

Not by default. A pip install of an unpinned package would have fetched the bad release during the window. Two things would have helped:

<table> <thead> <tr><th>Control</th><th>Would it have helped?</th></tr> </thead> <tbody> <tr><td>Pinning to 1.26.0 with hashes</td><td>Yes. The Hacker News advises pinning to the last safe version, 1.26.0</td></tr> <tr><td>Lockfile with committed hashes</td><td>Yes, installs would fail rather than pick up new files</td></tr> <tr><td>Egress filtering on build hosts</td><td>Likely. The stealer needs to reach webhook.site</td></tr> <tr><td>Scanning imports only</td><td>No. The payload ran without any import</td></tr> </tbody> </table>

What to do if you installed it

The guidance reported by The Hacker News is direct:

  1. Isolate affected hosts and CI runners.
  2. Pin to 1.26.0 and rebuild from a clean environment.
  3. Check whether any environment installed 1.26.1 or 1.26.2 in the window above.
  4. Search proxy and DNS logs for requests to the webhook.site endpoint named in the reports.
  5. Rotate exposed credentials from a clean machine.
  6. Audit Azure identities, sign-in logs and activity logs, and GitHub Actions workflows that deploy to Azure.

For a quick local check, look for unexpected .pth files in your site-packages directory. Any file you did not put there, containing an import line, deserves a look.

A quick audit you can run today

You do not need a vendor tool to find out where you stand. Start with the environments that matter most: CI runners, shared build images and any laptop that holds cloud credentials.

First, list installed versions of agent-framework in every virtual environment and container image, and flag anything at 1.26.1 or 1.26.2. Second, list every .pth file in each site-packages directory and read the ones that contain an import line. Legitimate packages use them, mostly for editable installs and namespace packages, so the point is to know what is there, not to delete everything. Third, check build logs for installs between roughly 8:35 and 9:20 p.m. UTC on November 17. Fourth, review cloud sign-in logs for token use from addresses you do not recognize, since the stealer asked for Azure identity tokens.

If any of those turn up a hit, assume the environment's credentials are burned and rotate them from a clean machine before doing anything else.

The bigger point

The hijacked package was not an obscure fork. It was an official framework from a major vendor, and the bad releases were live for well under an hour.

That short window is the uncomfortable part. A 45-minute exposure sounds harmless until you remember how many CI jobs, container builds and developer laptops run pip install every few minutes. Anything that resolved the latest version in that slice of the evening could have run the stealer, and the people affected may only learn about it from a vendor advisory days later. Detection that depends on someone noticing a news story is not detection.

There is also a trust problem. Teams often reason that a package from a big vendor is safe because the vendor is trustworthy. The vendor's code was never the issue here. The publishing path was, and nobody outside the vendor can see how well that path is protected. Hashes, lockfiles and a private mirror that delays new releases by a day or two are cheap ways to stop depending on that trust. The lesson is not "avoid AI frameworks". It is that agent code is ordinary Python with ordinary dependency risk, running with unusually valuable credentials.

Treat agent build environments like production: pinned and hashed dependencies, no long-lived cloud keys in developer shells, short-lived OIDC credentials scoped to one job, and outbound network rules that fail closed. We cover more on agent attack surface in our piece on AI agent security risks.

Frequently asked questions

Which versions were malicious?

Versions 1.26.1 and 1.26.2 of agent-framework on PyPI, published on November 17, 2026. Both have been quarantined, and 1.26.0 is the version recommended as safe.

Did I have to import the library to be affected?

No. Per Socket, the .pth file runs when the interpreter starts, so any Python process in that environment would run the collector.

Is Microsoft's whole agent ecosystem compromised?

The reports describe a compromise of the agent-framework PyPI package. They do not say other Microsoft packages were affected, and it is unclear how the attacker got publishing access.

How do I prevent this class of attack?

Pin and hash dependencies, restrict outbound traffic from build hosts, use short-lived scoped credentials, and review new .pth files in your environments.

Find what attackers can see, before they do.

AI pentesting agents test your web app, API and cloud, and every finding comes with evidence and a fix. First report in about 10 minutes.

Stay ahead of attackers.

New vulnerabilities, breach write-ups and practical fixes. A few emails a month.