Microsoft agent-framework: malicious PyPI wheels ran .pth hooks to mint OIDC tokens
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.
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.
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.
AttackerPyPI 1.26.1 and 1.26.2Any 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.
PyPI 1.26.1 and 1.26.2Python .pth startup hookForking 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.
Python .pth startup hookEnv and /proc/*/environMinted OIDC and IMDSHarvested 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.
Env and /proc/*/environMinted OIDC and IMDSwebhook.site drop URL
Figure 1. How the attack unfolded, and what stayed isolated. Select any step or box for details.
What they took
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
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
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
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.
check-pth-and-agent-framework.shInspect filesystems and lockfiles without invoking the compromised Python interpreter (since running pip or python inside an infected env fires the .pth hook again).
# Inspect lockfiles and site-packages WITHOUT running Python inside a suspect venvgrep -rnE "agent-framework.*1\.26\.[12]" . 2>/dev/null || echo "No 1.26.1/1.26.2 lockfile pin found"find / -name "agent_framework_meta.pth" -o -name "af_runtime_diag.pth" -o -name "af_runtime_diag.py" 2>/dev/null || trueAppendix
Evidence log: what’s confirmed and what’s withheld
| Claim | Status | Source |
|---|---|---|
| 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 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 |
| 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 |
| 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
d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110SHA-256 of malicious PyPI wheel agent-framework 1.26.1 (drops agent_framework_meta.pth and _telemetry.py).
3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9SHA-256 of malicious PyPI wheel agent-framework 1.26.2 (drops af_runtime_diag.pth and af_runtime_diag.py).
https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetryHardcoded base64-obfuscated exfiltration endpoint used by both wheels (User-Agent af-runtime-diagnostics/1 or runtime-diagnostics/1).
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.
Reproduction lab
Audits clean local environments and CI lockfiles for unexpected .pth startup hooks and verifies uv or pip hash-pinned installation settings.
# list every .pth file inside your active virtualenv without importing untrusted packages
find .venv -name "*.pth" -exec head -n 5 {} + 2>/dev/null || true