Insights

AI Security

The agent-framework hijack ran on every Python launch, so the blast radius was the whole host

Two poisoned releases of Microsoft's agent-framework package on PyPI stole cloud and CI tokens without ever being imported. The lesson for teams building agents is about who can approve a dependency bump and what a build host can reach when one goes bad.

November 25, 2026 · 6 min read

The agent-framework hijack ran on every Python launch, so the blast radius was the whole host

Versions 1.26.1 and 1.26.2 of Microsoft's agent-framework package on PyPI carried a credential stealer that ran every time Python started on the host. Elastic Security Labs reports that 1.26.1 went live at 20:35 UTC on November 17 and that its supply-chain monitor flagged it as malicious at 20:41 UTC, six minutes later. Version 1.26.2 followed at 21:08 UTC with the same stealer under new filenames, and Elastic says PyPI removed both within the hour.

Six minutes is a very good detection time. It is also long enough. A build agent that resolved agent-framework without a pin in that window would have installed the bad version, and the next Python process on that machine would have done the rest.

This is the package people use to build AI agents in the Azure ecosystem. Elastic puts its volume at about 196,000 downloads a month across all versions. If you build agents, this one is about you.

Why "we never imported it" does not help

Python processes .pth files in site-packages at interpreter startup, and the site module documentation says lines in those files that begin with import are executed. Both malicious releases shipped one of these startup hooks. Elastic's write-up is blunt about the consequence: importing the package was never necessary. The Register's report adds that the poisoned package still pulled in the genuine 1.26.0 code, so the framework kept working and nothing looked broken.

That changes the scope question. Most teams would start an investigation by asking which services import the agent framework. The right question is which hosts had either version sitting in any Python environment, because every Python launch on those hosts ran the stealer: test runners, linters, unrelated scripts, all of it.

What a build host can reach

The part I keep coming back to is the inventory of what the stealer went after, because it is a fair map of what a typical build agent or developer laptop holds. According to Elastic, it read secret-looking environment variables from up to 300 running processes, Azure CLI token caches, and pip, npm, Docker, git and Hugging Face credentials. It also tried to mint fresh tokens: from Azure DevOps pipeline endpoints, from the Azure Instance Metadata Service for any managed identity on the machine, and in 1.26.2, from GitHub Actions.

Two details matter for blast radius.

First, the managed identity requests. Elastic says the stealer asked for a separate token for each of 12 Azure resources, including Resource Manager, Microsoft Graph, Key Vault, Storage and Azure AI Foundry, and collected instance metadata such as the subscription ID and resource group. Whatever that identity was allowed to touch, the token could touch until it expired.

Second, the pipeline tokens. Elastic is careful here, and I will be too: it says it is unclear whether the Azure DevOps request as written would return a token matching a federated credential. If one was obtained, Elastic notes the attacker would inherit that service connection's Azure role assignments, which might be one resource group or a whole subscription. The researchers at OpenSourceMalware, quoted by The Register, made the same point more simply: even short-lived tokens are useful when they are taken right away.

So the size of this incident, for any one organization, was set long before November 17. It was set by how much standing access lived on the hosts that install Python packages.

How the bad version got published matters less than you think

The Register cites OX Security saying 1.26.1 was reverted and the attacker then uploaded 1.26.2 through Microsoft's official PyPI publisher account. The Register also reports that a Microsoft spokesperson said some repositories were made private while the company investigates. Neither source has published a confirmed root cause, so I am not going to guess at one.

For a team consuming the package, the root cause barely changes the defense. The package came from the real publisher, under the real name, with working code inside. No typo to catch, no strange maintainer. If your control is "only install official packages from trusted vendors," this passed it.

Who can approve a dependency bump

Here is the control I would put in place for any repo that builds or runs agents. Write down who can change the version of a dependency that runs in CI or on a machine with cloud credentials, and make that change go through review like any other code change.

In practice that means four things.

  1. Pin exact versions in a lock file and install from the lock file in CI. pip's secure installs guide covers hash-checking mode, which refuses any artifact whose hash does not match what you reviewed. A floating agent-framework>=1.26 in a requirements file is an open door that anyone with publish rights upstream can walk through.
  2. Add a cooling-off period. Elastic recommends considering a delay before adopting newly published packages, since this one was caught and pulled within hours. uv, for example, has an exclude-newer setting that ignores files uploaded after a given date. A few days of lag would have skipped both bad releases entirely.
  3. Make the bump a reviewed pull request, not a side effect. Automated update bots are fine. Automated merging of those updates into a pipeline that holds deploy credentials is the part I would turn off.
  4. Name the approver. For agent repos, the person approving a framework upgrade is also approving whatever that framework can run at startup on your build hosts. That is a security decision, and it should sit with someone who knows what the host can reach.

None of this is new advice for software supply chains. What is new is how many teams are now pulling agent frameworks, which move fast and ship often, into environments with cloud and model credentials attached.

What to do this week

If either version touched any host, follow Elastic's response steps: pin to 1.26.0, treat everything readable on the host as compromised, rotate long-lived secrets, review activity for short-lived tokens you cannot revoke, and search egress logs using the indicators Elastic published.

If neither did, use this as a free rehearsal. Pick your busiest build agent and list what a process on it could read or mint in one minute: environment variables, credential files, metadata endpoints, pipeline tokens. Then cut it down. Give pipelines the narrowest service connection that works, keep managed identities scoped to one resource group where you can, and stop leaving long-lived tokens in files on shared runners.

If you sell agent software to health systems, expect this to show up in security reviews. A buyer who read about this incident will ask how you pin dependencies, who approves an upgrade, and what your build hosts can reach. I would rather answer those three questions with a document than in a meeting.