Microsoft Agent Framework on PyPI: How a .pth File Stole Azure and CI Credentials on Every Python Startup

By Carlos Montiel | Enterprise AI Specialist
Leer en español →
Published: 2026-11-24 | By: Carlos Montiel | Reading time: ~6 minutes
Official Microsoft Agent Framework package on PyPI carried an Azure and CI credential stealer

On November 17, 2026, two fake versions of Microsoft's agent-framework package (1.26.1 and 1.26.2) appeared on PyPI and stole cloud credentials every time Python started. Here is how the trick works and what a company building agents should check.

What Happened

According to Socket, The Hacker News and SecurityWeek, versions 1.26.1 and 1.26.2 of the agent-framework package were published 33 minutes apart on November 17, 2026. The Hacker News places the exposure window between 8:35 and roughly 9:20 p.m. UTC. PyPI quarantined both versions; the last clean version is 1.26.0. The package gets about 190,000 monthly downloads (a figure for the whole package, not for the malicious versions: nobody has published how many were installed).

How it was published is still unexplained. The sources agree that it is unknown how the attacker obtained publishing rights. Wiz found no malicious code or equivalent release in Microsoft's main repository, which points to an upload outside the normal process. SafeDep identified a maintainer account named "vibiret," created the same day, but SecurityWeek clarifies that its involvement is not confirmed.

How It Works: Why a .pth Is Worse Than a Malicious Import

Python executes the import lines of any .pth file in site-packages every time the interpreter starts. The result, according to Endor Labs as cited by The Hacker News, is that the code runs on any Python execution in the environment, including pip, even if agent_framework is never imported.

Socket details two distinct variants, which matters for detection:

1.26.1: agent_framework_meta.pth -> agent_framework_meta/__init__.py -> _telemetry.py (forks, calls setsid and collects in the background; guard variable _AF_TEL) 1.26.2: af_runtime_diag.pth -> af_runtime_diag.py (the legitimate __init__.py is restored byte for byte)

That is why checking only agent_framework_meta/__init__.py won't detect 1.26.2. In addition, the packages still depended on the genuine agent-framework-core 1.26.0, so the framework worked normally and nobody noticed anything. The malicious versions shipped only compiled wheels, with no source distribution, unlike the legitimate releases.

What It Steals: It Doesn't Just Read, It Requests New Credentials

Environment variables are selected by text matching (TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI, HF_, FOUNDRY, TENANT, CLIENT, MANAGED; 1.26.2 adds ACTIONS, OIDC, RUNNER, ARM_). It also reads files such as Azure CLI credentials, .npmrc, .netrc, .git-credentials, .docker/config.json, Hugging Face tokens and .env files.

The most sensitive part, according to SafeDep as cited by The Hacker News: the code "asks the platform to issue new credentials." In Azure DevOps it uses SYSTEM_ACCESSTOKEN to request a federated token; on Azure compute it requests managed identity tokens for several resources (management, Key Vault, Storage, Graph, AI services); and 1.26.2 adds GitHub Actions OIDC tokens. Everything is compressed with zlib, Base64-encoded and sent over HTTPS to a webhook.site endpoint. Socket clarifies that the payloads do not download or execute additional code.

Microsoft's Response and What to Do

A maintainer confirmed on GitHub that the versions were pulled and that an investigation is underway. According to a November 20 update from The Hacker News, Microsoft made some repositories private, including microsoft/agent-framework and microsoft/onnxruntime, "while it investigates malicious content." SecurityWeek notes it is unclear whether the disappearance of ONNX Runtime repos is related. There is no CVE or formal security advisory in the sources reviewed.

What this means for your company: if any development environment, CI pipeline or container image installed 1.26.1 or 1.26.2, treat it as compromised: rebuild the environment from a pinned version (1.26.0), rotate credentials from a clean system, and also revoke tokens that may have been generated, not just the ones sitting on disk. Search proxy and DNS logs for traffic to webhook.site, audit Azure identities and activity logs, and review GitHub Actions workflows that deploy to Azure. Going forward: pin your agent dependencies with hashes, and keep CI runners from holding identities with more permissions than they need, because a poisoned package inherits everything the process can request.
Carlos Montiel
Enterprise AI Solutions Architect
Specialist in LLMs, Agents, and Orchestration
guatemalia.com/#contacto · info@guatemalia.com

Need to implement AI in your company?

Carlos Montiel is an enterprise AI solutions architect. He implements LLMs, Agents, RAG, and orchestrators for companies across Guatemala and Latin America. Reach out for a consultation.

Contact Carlos Montiel

info@guatemalia.com