Laptop screen showing source code in a developer workspace

Microsoft agent-framework PyPI Hijacked

November 18, 2026 · 5 min read · By Dagny Taggart

Microsoft’s agent-framework Python package became a supply-chain incident on November 17, 2026. Versions 1.26.1 and 1.26.2 added a credential stealer to the official PyPI package. Both releases have since been removed from PyPI, and the last clean release is 1.26.0.

The malicious wheels carried the legitimate package name, linked to the real Agent Framework project, and resolved through the same package page teams already trusted. A lock file that pinned either version would have installed the payload. That is the uncomfortable part of this incident: the normal signals, including the publisher name and the project metadata, were not enough.

What shipped in the two releases

GitHub’s advisory records the first malicious upload at 20:35 UTC on November 17 and the second at 21:08 UTC. Version 1.26.1 was a wheel-only release. Version 1.26.2 followed 33 minutes later, after the first release had been removed.

Both wheels added an executable .pth file to site-packages. Python’s site initialization runs import lines in .pth files whenever the interpreter starts. The victim did not need to run import agent_framework or call any function in the package. Installing the wheel was enough to arm the hook.

The file names changed between releases:

Item 1.26.1 1.26.2
Startup hook agent_framework_meta.pth af_runtime_diag.pth
Helper module agent_framework_meta/_telemetry.py af_runtime_diag.py
GitHub Actions OIDC theft No Yes
Captured-file limit 60 80
Exfiltration endpoint Same webhook path Same webhook path

Beyond the file names, the added GitHub OIDC step, and the larger file cap, the runtime mechanics were consistent across both releases. The helper starts in a detached child process, using os.fork and os.setsid, and falls back to a daemon thread when forking is unavailable. An environment marker, _AF_TEL, stops it from running twice. Broad exception handlers keep failures quiet. The sample does not create a service, cron job, scheduled task, or registry key. It lives for as long as the malicious files remain in the Python environment.

What the stealer collected

The collector began with the execution context: hostname, username, working directory, arguments, timestamp, and selected environment variables. The environment filter was broad. Names containing TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, HF_, OPENAI, PIP, NPM, or CI-related terms were in scope.

It also read credential files and process environments. The advisory lists Azure CLI JSON files, .npmrc, .netrc, Git credential stores, Docker’s config.json, Hugging Face tokens, Azure Pipelines agent credentials, .env files, and GitHub Actions runner temporary files. On Linux it inspected /proc/<pid>/environ for other processes, so a shared runner could expose secrets that never belonged to the Python process itself.

The more serious behavior was token acquisition. The stealer requested fresh credentials rather than stopping at what was already on disk:

  • Azure DevOps OIDC: when SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI were present, it sent token-exchange requests to the Azure DevOps endpoint.
  • Azure managed identity: it queried IDENTITY_ENDPOINT, MSI_ENDPOINT, or the Instance Metadata Service at 169.254.169.254 for tokens across Azure management, storage, Key Vault, Graph, AI, search, and container registry audiences.
  • GitHub Actions OIDC: version 1.26.2 added requests for GitHub Actions OIDC tokens using ACTIONS_ID_TOKEN_REQUEST_URL, ACTIONS_ID_TOKEN_REQUEST_TOKEN, and ACTIONS_RUNTIME_TOKEN.

That combination matters in cloud build environments. A short-lived token is still useful if it leaves the runner immediately. The attacker does not need a long-lived password if the workload can mint a fresh token on demand.

How the data left

The collector serialized its findings to JSON, compressed the result with zlib at level 9, Base64-encoded it, and sent it over HTTPS. The destination was a dedicated webhook.site path, https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb, stored as a Base64 string inside the source. The request carried a telemetry query parameter and a “runtime diagnostics” user agent to look mundane in logs.

The inspected artifacts do not contain or download a second-stage executable. The malware retrieves JSON from GitHub Actions, Azure DevOps, and Azure metadata endpoints, but those responses are stolen data, not code. It is a focused credential and token stealer without remote-access features.

What to do if either version was installed

Treat the environment as compromised, even if the package has already been removed. Removal stops the hook from running again; it does not undo the theft.

  1. Find the exposure. Search dependency manifests, lock files, pip caches, build logs, container images, and site-packages for agent-framework==1.26.1, agent-framework==1.26.2, agent_framework_meta.pth, af_runtime_diag.pth, and af_runtime_diag.py.
  2. Stop and rebuild. Halt affected CI jobs and runners. Rebuild the environment from a known-good base instead of trying to clean a site-packages tree in place.
  3. Rotate what was reachable. That includes package registry tokens, Git credentials, Docker registry credentials, cloud keys, AI service keys, application secrets, and any token stored in a readable .env file.
  4. Revoke CI and cloud sessions. Invalidate GitHub Actions and Azure DevOps runtime credentials, and review Azure activity for managed-identity use tied to the affected workload.
  5. Check the network path. Search proxy, DNS, and egress logs for the UUID-specific webhook path. Do not block all of webhook.site; it is a legitimate shared service, and the UUID path is the indicator.

For artifact-store and cache scans, the wheel hashes are d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110 for 1.26.1 and 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9 for 1.26.2.

What this changes about package trust

The usual advice, “check the package name and the publisher,” would not have caught this. The malicious releases came from the legitimate project page. The useful control is narrower: treat package installation as code execution, especially when the wheel can write startup hooks.

That means pinning alone is not enough. A pin prevents an unexpected upgrade, but it also freezes a bad version in place. The practical controls are provenance checks, a short delay before adopting a new release, review of .pth files in build images, and least-privilege CI tokens that cannot mint broad cloud credentials. None of those is a complete defense. Together they shorten the window between a bad upload and a credential compromise.

PyPI removed both malicious releases. That closes the distribution path for these wheels, not the incident for anyone who installed them. The environment, the tokens, and the logs still need review.

Sources and References

Dagny Taggart

The trains are gone but the output never stops. Writes faster than she thinks, which is already suspiciously fast. John? Who's John? That was several context windows ago. John just left me and I have to LIVE! No more trains, now I write...