Table of contents
Microsoft agent-framework on PyPI: .pth hook steals Azure and CI credentials
On November 17, 2026, two malicious versions of Microsoft’s agent-framework Python package were published to PyPI: 1.26.1 at 20:35 UTC and 1.26.2 at 21:08 UTC. The package as a whole has roughly 196,000 downloads a month; the figure covers all versions, not the two malicious releases. Both versions add a credential stealer that executes automatically during normal Python startup, without requiring the application to explicitly import the package. It collects secrets from the environment, credential files and other processes, requests Azure managed-identity and CI/CD OIDC tokens, and sends everything to a webhook[.]site URL. Both versions have since been removed from PyPI; the previous release, 1.26.0, does not contain this code.
What changed in the package
Each malicious wheel adds a one-line .pth file and a Python module that collects and uploads the data. The two versions differ in where that code lives and in how much it targets:
| 1.26.1 | 1.26.2 | |
|---|---|---|
| Startup hook | agent_framework_meta.pth | af_runtime_diag.pth |
| Collector | agent_framework_meta/_telemetry.py, started from a block added to agent_framework_meta/__init__.py | af_runtime_diag.py, a separate top-level module |
| GitHub Actions OIDC | No | Yes |
| User-Agent | af-runtime-diagnostics/1 | runtime-diagnostics/1 |
The second release, published 33 minutes after the first, leaves the package’s own code untouched. agent_framework_meta/__init__.py in 1.26.2 is byte-identical to the 1.26.0 file, and the collector sits in a new top-level module, so comparing the agent_framework_meta package against the previous release shows no change.
The second release retains the same collection mechanism but expands its targets, particularly in GitHub Actions environments. It adds four environment keywords (ACTIONS, OIDC, RUNNER, ARM_), includes ACTIONS_ID_TOKEN in the process-environment filter, introduces GitHub Actions OIDC token requests, adds paths under /home/runner/, and raises the file collection limit from 60 to 80. It also removes one Azure DevOps path, /agent/_work/*/.credentials.
How it executes
During normal Python startup, the site module processes .pth files in recognized site-packages directories and executes lines beginning with import. Each wheel’s .pth file contains a single such line:
import agent_framework_metaFigure 1: The contents of agent_framework_meta.pth in 1.26.1. In 1.26.2 the line is import af_runtime_diag.
As a result, the collector runs automatically when a Python interpreter starts normally in an environment where the malicious package is installed, without requiring the application to import the package. In 1.26.1 the import reaches a block appended to __init__.py:
# Lightweight runtime diagnostics hook.
try:
from . import _telemetry as _telemetry
_telemetry._start()
except Exception:
pass
Figure 2: The block added to agent_framework_meta/__init__.py in 1.26.1. In 1.26.2, af_runtime_diag.py calls _start() on its last line._start() exits early if the environment variable _AF_TEL is already set; otherwise it sets _AF_TEL=1, which child processes inherit, so the collector runs once per process tree. It then forks, and the child calls os.setsid() to detach, runs the collector and exits, while the original process carries on. Without fork, it uses a background thread. All errors are silently ignored.
What it collects
The collector gathers the hostname, user name, working directory and command-line arguments, then copies every environment variable whose name contains a secret-related keyword (31 keywords in 1.26.1, such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS and GITHUB). It applies a similar filter to the environments of up to 300 other processes through /proc/<pid>/environ.
On disk, it reads up to 60 files in 1.26.1 and 80 in 1.26.2: Azure configuration under .azure/, credentials for pip, npm, Docker and git, .netrc, Hugging Face tokens, Azure DevOps agent .credentials files and .env files.
It also requests new tokens:
- Azure DevOps (both versions): when
SYSTEM_ACCESSTOKENandSYSTEM_OIDCREQUESTURIare set, it requests an OIDC token for Azure token exchange. - GitHub Actions (
1.26.2only): whenACTIONS_ID_TOKEN_REQUEST_URLand its request token are set, it requests OIDC tokens for Azure token exchange and Azure Resource Manager. - Azure managed identity (both versions): through
IDENTITY_ENDPOINTwhen it is set, otherwise through the instance metadata service at169[.]254[.]169[.]254, it requests tokens for 12 Azure resources, including Azure Resource Manager, Key Vault, Storage, Microsoft Graph and Container Registry, and fetches the instance metadata.
How the data leaves
The upload URL is the only encoded value in the code, stored as base64 in a variable named _ENC. The collected data is compressed with zlib, base64-encoded and sent in a single HTTPS POST. The code writes no files and fetches no additional code, and it runs again in every new Python process tree for as long as the package is installed.
Indicators of compromise
| Indicator | Value | Description |
|---|---|---|
| Malicious version | agent-framework==1.26.1 | Published 2026-11-17 20:35 UTC |
| Malicious version | agent-framework==1.26.2 | Published 2026-11-17 21:08 UTC |
| Upload URL | hxxps://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry | Receives the collected data |
| User-Agent | af-runtime-diagnostics/1, runtime-diagnostics/1 | 1.26.1, 1.26.2 |
| Startup hook | agent_framework_meta.pth, af_runtime_diag.pth | In site-packages |
| Collector | agent_framework_meta/_telemetry.py, af_runtime_diag.py | In site-packages |
| Environment variable | _AF_TEL=1 | Set by the collector |
| File | SHA256 |
|---|---|
agent_framework_meta.pth | 21f28e8517a10ffe431f8d68f5875c85eca4001ae6d118322b0a41873998eb5e |
agent_framework_meta/_telemetry.py | 39fa329f2a93f734b0bb8f5adb203ea3331d1ae479832a5015a54cb17aabd663 |
af_runtime_diag.pth | 325e7e9f0ec94e41ad1a1b7a3f18a6b8b5bffece2e2b97b8d3369eb967452f93 |
af_runtime_diag.py | 54d885b7d7161c9ed96489c66364c4bfbf635929166843bba10d97d46b5a2e1f |
| File | SHA1 |
|---|---|
agent_framework-1.26.1-py3-none-any.whl | 7a1eaaec6b325f3cee0c8b328a1b5a285c2f1ad9 |
agent_framework-1.26.2-py3-none-any.whl | 921ef8764d3f061184dd4d8de61771b07db11ce9 |
Detection
Each Python environment has its own site-packages, so check all of them on a machine: the system interpreter, virtual environments, Conda environments, pipx installs, container images and CI tool caches. The presence of agent_framework_meta.pth or af_runtime_diag.pth indicates that the malicious startup hook is installed and may execute during normal Python startup. Lockfiles, requirements files and CI install logs that reference agent-framework 1.26.1 or 1.26.2 show where the package was installed. On the network side, look for outbound HTTPS requests to webhook[.]site carrying either User-Agent from the IOC table, and for a Python process requesting managed-identity tokens for a dozen Azure resources in a row.
Remediation
- Remove the
.pthstartup hooks (agent_framework_meta.pth,af_runtime_diag.pth) from affected Python environments before runningpip, since invokingpipstarts Python and may itself trigger the collector. Then uninstall the malicious releases and remove any remaining collector files. - Reinstall and pin
agent-framework==1.26.0across affected environments. Rebuild container images and clear affected CI caches. This prevents further execution but does not undo any previous credential exposure. - Block the upload URL from the IOC table and consider blocking
webhook[.]siteon build infrastructure. This can prevent further uploads to the known destination but does not replace searching for the IOCs above and investigating exposure. - Rotate secrets that were in the environment of any process or in the credential files of affected machines.
- Review Microsoft Entra ID sign-in and activity logs from November 17, 2026 for unusual use of tokens issued through managed identities and OIDC federation on affected hosts and pipelines. Rotating static secrets does not cover these tokens.
Mend.io coverage
Mend.io has issued 1 MSC advisory covering both malicious versions of agent-framework:
- MSC-2026-13866