# Microsoft Agent Framework PyPI Compromise | How a 55-Minute Release Stole Cloud Secrets

- Link: https://secithub.com/microsoft-agent-framework-pypi-compromise/
- Published: 2026-11-18T15:09:35+02:00
- Author: SECITHUB

Reading Time:   5 min

A malicious **Microsoft Agent Framework PyPI** release went live on the evening 
of November 17, 2026. Two poisoned versions of the `agent-framework` package, 1.26.1
and 1.26.2, sat on the Python Package Index for about 55 minutes. In that window,
any developer laptop, CI runner or container that pulled them ran a credential stealer
aimed squarely at Azure, GitHub and AI developer secrets.

Wiz researchers caught and analyzed the release. The package sees about 41,000 downloads
a week, so even a short window matters. It also follows several PyPI attacks this
year that used the same trick: a startup hook that runs before your code does.

Table of Contents

 [Toggle](https://secithub.com/microsoft-agent-framework-pypi-compromise/#)

 * [What Happened to the Microsoft Agent Framework PyPI Package](https://secithub.com/microsoft-agent-framework-pypi-compromise/#What_Happened_to_the_Microsoft_Agent_Framework_PyPI_Package)
    - [A 55-minute window](https://secithub.com/microsoft-agent-framework-pypi-compromise/#A_55-minute_window)
    - [Built outside the normal pipeline](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Built_outside_the_normal_pipeline)
    - [A second version that hid better](https://secithub.com/microsoft-agent-framework-pypi-compromise/#A_second_version_that_hid_better)
 * [How the Stealer Works](https://secithub.com/microsoft-agent-framework-pypi-compromise/#How_the_Stealer_Works)
    - [A .pth file runs it on every Python start](https://secithub.com/microsoft-agent-framework-pypi-compromise/#A_pth_file_runs_it_on_every_Python_start)
    - [It harvests secrets from everywhere](https://secithub.com/microsoft-agent-framework-pypi-compromise/#It_harvests_secrets_from_everywhere)
    - [One quiet upload](https://secithub.com/microsoft-agent-framework-pypi-compromise/#One_quiet_upload)
    - [A small catch, a big risk](https://secithub.com/microsoft-agent-framework-pypi-compromise/#A_small_catch_a_big_risk)
 * [Why AI Developer Tooling Is Now a Prime Target](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Why_AI_Developer_Tooling_Is_Now_a_Prime_Target)
    - [Microsoft packages have been hit before](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Microsoft_packages_have_been_hit_before)
    - [Startup hooks are the new favorite](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Startup_hooks_are_the_new_favorite)
    - [Agent builders hold the keys](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Agent_builders_hold_the_keys)
    - [Provenance checks help, but only if you use them](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Provenance_checks_help_but_only_if_you_use_them)
 * [What to Do Now](https://secithub.com/microsoft-agent-framework-pypi-compromise/#What_to_Do_Now)
    - [Sources](https://secithub.com/microsoft-agent-framework-pypi-compromise/#Sources)

## **What Happened to the Microsoft Agent Framework PyPI Package**

Microsoft Agent Framework is the company’s open-source toolkit for building AI agents
in Python and .NET. Its PyPI package is a common dependency in agent projects and
Azure AI pipelines.

### **A 55-minute window**

Version 1.26.1 appeared at 20:35 UTC. A second malicious build, 1.26.2, followed
around 21:08 UTC. PyPI quarantined both by about 21:30 UTC. The last clean release
is 1.26.0, published on November 12.

### **Built outside the normal pipeline**

The Microsoft GitHub repository has no tag or release for 1.26.1, and its main branch
holds no malicious code. Legitimate releases ship a wheel, a source distribution
and a matching `agent-framework-core` version. The bad release shipped a lone wheel.
Everything points to a direct upload with stolen publishing access, although the
root cause is not yet confirmed.

### **A second version that hid better**

The attacker did not stop at one build. Version 1.26.2 renamed its files, restored
a clean `__init__.py` and widened its target list. Teams that searched only for 
the 1.26.1 file names would miss it.

    ```wp-block-verse
    Fifty-five minutes is all a stolen publishing token needs.
    ```

## **How the Stealer Works**

The payload is simple, quiet and fast. It aims to grab as many secrets as possible
in one shot.

### **A .pth file runs it on every Python start**

Each version drops a `.pth` file into `site-packages`. Python executes these files
every time the interpreter starts. So the stealer runs even if your code never imports`
agent-framework`. Any Python process in an affected environment triggered it.

### **It harvests secrets from everywhere**

 * Environment variables with names like TOKEN, SECRET, KEY, AZURE, AWS, GITHUB,
   OPENAI and HF_
 * Secret values from up to 300 other running processes
 * Up to 80 credential files, including Azure CLI config, `.npmrc`, `.git-credentials`,
   Docker config and Hugging Face tokens
 * Azure managed identity tokens from the instance metadata service
 * Azure DevOps and GitHub Actions OIDC tokens that can be swapped for Azure access

### **One quiet upload**

The stealer packs everything into one compressed JSON blob and sends it in a single
HTTPS POST to a webhook.site URL. File and function names mimic SDK telemetry, so
a quick glance looks harmless. It does not retry on failure and leaves little noise
behind.

### **A small catch, a big risk**

The attacker used a free webhook.site account, which caps captures at 100 requests.
Wiz says no more than 50 requests landed. That sounds small, but a single CI runner
can hold keys to an entire cloud tenant.

## **Why AI Developer Tooling Is Now a Prime Target**

This attack fits a clear 2026 pattern. Attackers go after the packages that AI developers
trust most, because those environments hold the richest secrets. The same trust 
problem reaches beyond package registries: the **_[Optimizely supply chain attack](https://secithub.com/optimizely-supply-chain-attack/)_**
abused a trusted web platform to inject malicious code into 178 sites.

### **Microsoft packages have been hit before**

In May 2026, attackers used a stolen PyPI token to push three trojanized versions
of Microsoft’s `durabletask` SDK. Wiz has not linked the two incidents. Still, a
second Microsoft Python package hit through the same kind of direct upload raises
hard questions about publishing controls.

### **Startup hooks are the new favorite**

In June, a wave of poisoned wheels known as Hades spread through 19 PyPI packages
using `.pth` hooks. In October, a compromised LiteLLM release used the same Python
startup trick to steal credentials. Defenders often scan imports and entry points.
A `.pth` file slips past that, because it runs before any of your code loads.

### **Agent builders hold the keys**

Teams that build AI agents keep model API keys, cloud identities and deployment 
tokens close at hand. Their pipelines often have broad Azure rights. That makes 
them a far better haul than an average web app. Our guide to **_[securing AI bots](https://secithub.com/secure-ai-bot-2025/)_**
covers why these secrets need tighter scope.

### **Provenance checks help, but only if you use them**

The bad release broke every pattern of a normal Microsoft build. It had no Git tag,
no source distribution and no matching core package. Tools that compare a release
against its repository and build history would have flagged it at once. Few teams
run those checks before they install.

## **What to Do Now**

If any environment you run installed `agent-framework` between 20:35 and 21:30 UTC
on November 17, treat it as compromised.

 1. **Find exposure.** Search lockfiles, CI logs, virtual environments and container
    images for versions 1.26.1 or 1.26.2. Pin to 1.26.0.
 2. **Check for the files.** Look in `site-packages` for `agent_framework_meta.pth`
    or `af_runtime_diag.pth`, and for the `_AF_TEL=1` variable.
 3. **Check egress.** Search proxy and DNS logs for `webhook.site/d381fd80-ec62-42ad-
    8f5c-d1b15103c9bb`.
 4. **Rotate everything.** Replace environment secrets, Azure CLI sessions, Azure DevOps
    tokens, git credentials, and npm, PyPI, Docker and Hugging Face tokens on affected
    hosts.
 5. **Audit Azure identities.** Review sign-in logs for managed identities and federated
    credentials. Stolen tokens may stay valid for up to 24 hours.
 6. **Harden your pipeline.** Pin dependencies with hashes, delay new versions by a
    few days, and give CI jobs only the cloud rights they need. Our **_[supply chain security guide](https://secithub.com/supply-chain-security-guide-2025/)_**
    walks through these controls.

    ```wp-block-verse
    Pin your versions, scope your tokens and assume the next poisoned release is already on its way.
    ```

The Microsoft Agent Framework PyPI compromise lasted less than an hour, yet it could
reach deep into cloud environments. A trusted vendor name and a familiar package
were enough to put a stealer in front of thousands of builds.

The fix is not to stop trusting open source. It is to stop trusting it blindly. 
Hash pinning, release delays and least-privilege CI tokens turn a 55-minute attack
into a non-event.

Want to see how attackers move through partners, packages and SaaS links long before
anyone notices?

**_[Read our deep-dive: The New Perimeter is the Supply Chain | Managing Third-Party and SaaS Risk.](https://secithub.com/modern-cyber-defense-strategies-2026/)_**

    ```wp-block-verse
    Lock down your build pipeline before the next poisoned package lands in it.
    ```

![SECITHUB FAQ banner for the Microsoft Agent Framework PyPI compromise covering
malicious versions, credential theft and remediation](https://secithub.com/wp-content/
uploads/2025/12/SECITHUB-FAQ-1.jpg)

**Which Microsoft Agent Framework PyPI versions are malicious?**

Versions 1.26.1 and 1.26.2 of the agent-framework package. The last safe version
is 1.26.0.

**How long were the malicious versions available?**

About 55 minutes on November 17, 2026, from 20:35 UTC until PyPI removed them around
21:30 UTC.

**Do I need to import the package to be affected?**

No. A .pth file runs on every Python start, so any Python process in an affected
environment ran the stealer.

**What did the malware steal?**

Secrets from environment variables, credential files, other processes, Azure managed
identities and CI OIDC tokens.

**How do I check if I was hit?**

Search for versions 1.26.1 or 1.26.2, look for agent_framework_meta.pth or af_runtime_diag.
pth, and check logs for the webhook.site URL.

**What should I do if I installed a bad version?**

Pin to 1.26.0, rotate every secret on the affected host or runner, and audit Azure
sign-in logs for the exposed identities.

### **Sources**

_[Malicious version of Microsoft’s Agent Framework published to PyPI – Wiz](https://www.wiz.io/blog/malicious-version-of-microsofts-agent-framework-published-to-pypi)_

_[Inside the LiteLLM 1.107.0 supply chain compromise – Microsoft Security](https://microsoft.com/en-us/security/blog/2026/10/23/inside-the-litellm-1-107-0-supply-chain-compromise-credential-theft-through-python-startup-hooks)_
