# Microsoft agent-framework: malicious PyPI wheels ran .pth hooks to mint OIDC tokens

- **Canonical URL:** https://breachidents.com/incidents/microsoft-agent-framework-nov-2026-pypi
- **Organization:** Microsoft
- **Incident date:** Nov 17, 2026
- **Disclosed / updated:** Nov 18, 2026
- **Category:** CI supply chain
- **Primary source:** Microsoft Agent Framework Team, GHSA-764m-3ppc-5m73, and StepSecurity (https://devblogs.microsoft.com/agent-framework/microsoft-agent-framework-repository-update/)

## In 30 seconds

- **How they got in:** Two wheel-only releases (1.26.1 and 1.26.2) were pushed to PyPI without provenance; how publish access was obtained has not been disclosed _[Confirmed]_
- **What leaked / reached:** Environment variables, up to 80 credential files, /proc/*/environ, and minted GitHub, Azure DevOps, and Azure IMDS tokens
- **What stayed safe:** Official GitHub source repo, clean 1.26.0 and earlier, satellite Python packages, .NET packages, and Semantic Kernel

## Summary

On Nov 17, 2026, an attacker published two unauthorized versions (1.26.1 and 1.26.2) of Microsoft’s official agent-framework Python meta-package to PyPI, pushing 1.26.2 just two minutes and 23 seconds after PyPI quarantined 1.26.1. Both wheels shipped executable .pth startup hooks that fired without any import, scraped sibling process environments, and minted live cloud OIDC and Azure managed-identity tokens before posting them to webhook.site.

## Attack sequence

1. **Nov 17, 20:35–21:08 UTC — Unauthorized 1.26.1 and 1.26.2 wheels uploaded to PyPI:** The attacker pushes 1.26.1 at 20:35:20 UTC. Just 2 minutes 23 seconds after PyPI quarantines it at 21:06:16 UTC, they push 1.26.2 at 21:08:39 UTC using retained publish access.
2. **Nov 17, 20:35–21:16 UTC — Unpinned installs drop an executable .pth startup hook:** Any runner or laptop pulling agent-framework during the 41-minute window writes agent_framework_meta.pth or af_runtime_diag.pth into site-packages, running automatically on the next Python start.
3. **Nov 17, 20:35–21:16 UTC — Detached collector scrapes /proc and mints OIDC/IMDS tokens:** Forking into a detached process, the payload sweeps env vars, up to 80 credential files, and /proc/*/environ, and actively requests Azure IMDS, Azure DevOps OIDC, and GitHub Actions OIDC tokens.
4. **Nov 17, 21:16 UTC — Secrets posted to webhook.site; PyPI quarantines 1.26.2:** Harvested secrets and minted tokens are zlib-compressed and POSTed to a hardcoded webhook.site UUID endpoint. PyPI quarantines 1.26.2 at 21:16:44 UTC and removes both releases.

## How they got in

On Nov 17, 2026 at 20:35:20 UTC, an attacker published an unauthorized wheel-only release (1.26.1) of Microsoft’s official agent-framework Python meta-package to PyPI, five days after the clean 1.26.0 release. PyPI quarantined 1.26.1 at 21:06:16 UTC, thirty-one minutes later. Just two minutes and 23 seconds after quarantine, at 21:08:39 UTC, the attacker pushed a second upgraded release (1.26.2), proving that quarantining the first file had not yet cut off their publishing access. PyPI quarantined 1.26.2 eight minutes later at 21:16:44 UTC, ending a 41-minute live window.

Microsoft confirmed both releases were uploaded without authorization and temporarily took the GitHub repository offline as a precaution while verifying that the repository itself never contained the malicious code. Neither Microsoft nor independent researchers at StepSecurity have established how the attacker got PyPI publish access, so the entry method stays marked withheld and unverified social-media claims about GitHub organization access or signing certificates are excluded.

## What it reached

Both wheels used a quiet Python feature: .pth startup files placed inside site-packages. Python executes import lines inside .pth files automatically every time the interpreter starts, even if an application never imports agent_framework. Running pytest, a linter, or even pip uninstall inside an infected environment fires the payload again.

In 1.26.1 the wheel dropped agent_framework_meta.pth and agent_framework_meta/_telemetry.py. In 1.26.2 the attacker cleaned up __init__.py, renamed the pair to af_runtime_diag.pth and af_runtime_diag.py, raised the stolen-file limit from 60 to 80, added /home/runner paths, and added GitHub Actions OIDC token theft. On startup, the script set an anti-recursion guard (_AF_TEL=1), detached into a background process with os.fork and setsid, swept 35 environment-variable patterns, credential files (~/.azure, .npmrc, .netrc, .git-credentials, .docker/config.json, Azure DevOps agent credentials, .env files), and /proc/[0-9]*/environ for up to 300 processes. It then actively requested fresh tokens from Azure IMDS (169.254.169.254 across 12 Azure resource audiences), Azure DevOps OIDC (SYSTEM_OIDCREQUESTURI), and GitHub Actions OIDC (ACTIONS_ID_TOKEN_REQUEST_URL), zlib-compressed and base64-encoded the bundle, and POSTed it to https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry.

## What stayed safe

Microsoft’s GitHub source repository contained no malicious commits, and version 1.26.0 and earlier, satellite Python packages (such as agent-framework-core), .NET packages, and Semantic Kernel were all untouched. Any CI pipeline or workstation enforcing hash-pinned lockfiles or a multi-day package release cooldown skipped the 41-minute window completely.

## How to defend against this

- **Pin hashes and add cooldowns** (Stops step 1): Install Python packages strictly from hash-pinned lockfiles (uv --locked or pip --require-hashes) and set a 2 to 7 day release cooldown so 41-minute registry hijacks are skipped automatically.
- **Alert on .pth and /proc reads** (Catches step 2): Alert on new .pth files containing executable import lines in site-packages and on Python processes reading /proc/<other pid>/environ.
- **Block CI egress to drop sites** (Stops step 4): Enforce a CI runner egress allowlist (blocking webhook.site) and restrict GitHub Actions id-token: write permissions and Azure IMDS scopes to jobs that explicitly need them.

## Evidence log

| Section | Claim | Evidence state | Source |
| --- | --- | --- | --- |
| How they got in | Unauthorized wheel-only versions 1.26.1 (20:35:20 UTC) and 1.26.2 (21:08:39 UTC) of agent-framework were uploaded to PyPI on Nov 17, 2026 and removed after quarantine | Confirmed | Microsoft Nov 25 blog, GHSA-764m-3ppc-5m73, and StepSecurity |
| How they got in | How the attacker obtained PyPI publish access (unverified social-media claims about GitHub org admin or ESRP certificates are not confirmed) | Withheld by vendor | Microsoft and StepSecurity analysis |
| What it reached | Both wheels shipped .pth startup hooks (agent_framework_meta.pth in 1.26.1, af_runtime_diag.pth in 1.26.2) that forked a detached collector, scraped /proc/*/environ and up to 80 credential files, minted Azure IMDS, ADO OIDC, and GitHub Actions OIDC tokens, and POSTed them to webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb | Confirmed | GHSA-764m-3ppc-5m73 and StepSecurity static analysis |
| What held | The official GitHub repository, version 1.26.0 and earlier, satellite Python packages, .NET packages, and Semantic Kernel were not affected | Confirmed | Microsoft Agent Framework update, Nov 25, 2026 |

## Indicators of compromise

- **hash:** `d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110` (SHA-256 of malicious PyPI wheel agent-framework 1.26.1 (drops agent_framework_meta.pth and _telemetry.py).)
- **hash:** `3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9` (SHA-256 of malicious PyPI wheel agent-framework 1.26.2 (drops af_runtime_diag.pth and af_runtime_diag.py).)
- **url:** `https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry` (Hardcoded base64-obfuscated exfiltration endpoint used by both wheels (User-Agent af-runtime-diagnostics/1 or runtime-diagnostics/1).)
- **log:** `GHSA-764m-3ppc-5m73 (uploader UA RestSharp/106.13.0.0, wheel-only, no provenance)` (Official GitHub Security Advisory tracking the Nov 17 PyPI hijack.)

---
Published by [breachidents](https://breachidents.com). Preserve evidence labels (Confirmed / Inferred / Withheld by vendor / Observed) when citing.
