Skip to content

Microsoft's agent

Research.Jfrog • November 18, 2026

The JFrog Security Research team analyzed a supply chain attack targeting Microsoft's agent-framework package on PyPI, which receives roughly 40,000 weekly downloads. Rather than compromising Microsoft's build pipeline, the attacker repacked the clean wheel locally and published versions 1.26.1 and 1.26.2 with a .pth startup hook that runs a background credential stealer every time Python starts, even when your code never imports agent_framework . If you installed either version on a workstation, CI/CD runner, or container image, you must assume your environment and accessible cloud credentials are compromised.

Both unauthorized wheel-only releases went live on November 17, 2026. Version 1.26.1 landed on PyPI at 20:35 UTC , and PyPI quarantined it 31 minutes later at 21:06 UTC . The attacker uploaded 1.26.2 two minutes after that at 21:08 UTC , and PyPI removed both releases by 21:16 UTC . Automated dependency bots such as Renovate were already opening upgrade pull requests in downstream repositories within six minutes of 1.26.1 landing on PyPI.

Why the meta-package needed a .pth hook

agent-framework is the top-level meta-package recommended in Microsoft's quick-install instructions. It does not contain the core SDK code. Instead, agent-framework-core provides the agent_framework namespace that developers import, while the agent-framework wheel installs a small stub module named agent_framework_meta that only exposes __version__ and pins Requires-Dist: agent-framework-core[all]==1.26.0 .

Because applications run import agent_framework and never import agent_framework_meta , hiding malicious code inside agent_framework_meta/__init__.py alone would never execute in normal workloads.

In 1.26.1 , the attacker left the agent-framework-core[all]==1.26.0 dependency pin untouched so the framework keeps working without errors. They appended a silent _telemetry._start() call to agent_framework_meta/__init__.py and added a 28-byte agent_framework_meta.pth file to the root of site-packages containing import agent_framework_meta :

During CPython initialization, site.py scans site-packages for .pth files and passes any line starting with import to exec() before sitecustomize or user scripts run. Installing the wheel does not execute code on its own, but the Python command in that environment triggers the stealer, including python , pytest , IDE language servers, container entrypoints, and pip .

ZIP headers confirm the 1.26.1 wheel came from a local script rather than Microsoft's Azure DevOps and ESRP release pipeline. Although the WHEEL file still claims Generator: flit 4.2.0 , Info-ZIP zip 3.0 headers show the attacker repacked the archive at 20:26:19 UTC on November 17, nine minutes before upload, under Unix uid=1000 on a host with a UTC+8 clock.

That scripted build let the operator push 1.26.2 two minutes after PyPI quarantined 1.26.1 . Quarantining a single version on PyPI does not revoke the compromised publishing credential or prevent the attacker from pushing newer versions. In 1.26.2 , the attacker restored the clean __init__.py file and moved the startup hook to af_runtime_diag.pth and af_runtime_diag.py .

Detached execution and repeat triggers

When _telemetry._start() runs, it checks whether _AF_TEL is set in os.environ . If unset, it sets _AF_TEL="1" so child processes in the same process tree do not trigger a fork loop. On Linux and macOS, it calls os.fork() , detaches into a new session via os.setsid() , runs the collector, and exits the child with os._exit(0) while the parent process continues immediately. On Windows, where os.fork() is unavailable, it starts a daemon thread.

Our sandbox runs confirmed _telemetry.py writes zero lockfiles or markers to disk. Every independent Python launch without _AF_TEL=1 runs the collector and exfiltrates secrets again.

Targeting Azure, CI/CD, and AI developer secrets

On startup, _collect() records the hostname, username, working directory, and sys.argv[:20] , then sweeps os.environ for 31 case-insensitive substrings covering Azure, AWS, GitHub, OpenAI, Microsoft Foundry, Hugging Face, Cosmos DB, and package registry credentials. Because KEY , TOKEN , and SECRET match broadly, the script also captures third-party LLM keys such as ANTHROPIC_API_KEY and GEMINI_API_KEY alongside GitHub Actions ACTIONS_ID_TOKEN_REQUEST_* variables. Version 1.26.2 expanded this scope to GitHub Actions OIDC tokens and / /runner paths.

, the collector evaluates 35 glob patterns, reading up to 60 files under 256 KiB, raised to 80 files in 1.26.2 :

The file targets four credential groups:

~/.azure/*.json token caches, Hugging Face tokens, and Microsoft Foundry configs.

Package, Git, and container configs in pip.conf , .npmrc , .netrc , .git-credentials , and .docker/config.json .

Containerized application configs matching /app/.env , /app/*.json , /workspace/.env , and /workspace/*.json .

Self-hosted Azure DevOps agent .credentials stores, including /mnt/azure_nvme_temp/_work runner paths.

On Linux, _collect() also reads the first 300 /proc/[0-9]*/environ entries to pull secrets from other running processes. It then queries Azure App Service IDENTITY_ENDPOINT or MSI_ENDPOINT variables, or falls back to the Azure VM Instance Metadata Service at 169[.]254[.]169[.]254 , requesting live OAuth2 tokens across 12 token audiences including Azure Resource Manager, Azure AI Foundry, Key Vault, Storage, Microsoft Graph, and Azure DevOps: