← All articles

Agent-framework PyPI package carried a cloud credential stealer

Agent-framework PyPI package carried a cloud credential stealer

The agent-framework package on PyPI, Python’s public package repository, was compromised with a credential stealer that can run every time Python starts. Reports from Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity and Google-owned Wiz identified malicious versions 1.26.1 and 1.26.2. They were published 33 minutes apart on November 17, 2026, and had been quarantined on PyPI at the time of reporting. It remains unclear how the attacker obtained publishing access.

Agent-framework is the meta-package for Microsoft Agent Framework, an open-source system for building and coordinating artificial intelligence agents with Python. The compromised releases install startup hooks that collect credentials, environment information and cloud identity tokens, then send the data to a webhook[.]site address. A startup hook is code that runs automatically when a program begins, rather than waiting for a user to import or launch a particular feature.

Each malicious release places a .pth file in Python’s site-packages directory. Python automatically processes import lines in these files whenever an interpreter starts, so the stealer can run on any Python launch in the affected environment. That includes pip, the tool used to install Python packages, even when no application imports Agent Framework. Version 1.26.1 uses the file agent_framework_meta.pth, while version 1.26.2 uses af_runtime_diag.pth.

The agent_framework_meta.pth file contains an import statement that starts the agent_framework_meta payload. According to the security reports, it searches environment variables using substring matches and reads credential files linked to Azure CLI, .npmrc, pip.conf, .netrc, .git-credentials, .docker/config.json, Hugging Face, Microsoft Azure DevOps agents, plus .env and JSON files. It also collects Azure DevOps OpenID Connect, or OIDC, tokens, Azure managed-identity tokens, Azure instance metadata and up to 8,000 characters of the metadata response.

The theft is not limited to secrets already stored on disk. SafeDep said the code can ask platforms to issue new credentials. In an Azure DevOps pipeline, the SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI values can be used to request a federated token for api://AzureADTokenExchange. On Azure compute systems, the malware requests access tokens for resources through the managed identity endpoint. It uses IDENTITY_ENDPOINT or MSI_ENDPOINT on App Service and Functions, and the local address 169.254.169[.]254 elsewhere. It also retrieves instance metadata.

The Azure instance metadata service, or IMDS, is a local RESTful web service that provides information about a virtual machine, including its region, tags and identity token. This means rotating secrets that were already saved on a machine may not be enough when the malware could request fresh tokens from the platform.

The collected information is assembled into a JSON document, compressed with zlib, encoded with Base64 and sent in an HTTPS POST request to the hard-coded address webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb. Version 1.26.2 additionally imports a new top-level module named af_runtime_diag.py, harvests GitHub Actions OIDC tokens and broadens the patterns used to find credential-related environment variables.

Agent-framework receives about 190,000 downloads each month, making the incident relevant to development teams, automated build systems and cloud workloads that install the package. Security teams were advised to isolate affected hosts and runners, pin the package to the most recent safe version, 1.26.0, and restore those environments from a clean source. They should check whether either malicious release was present between 8:35 and roughly 9:20 p.m. UTC on November 17, 2026, and search proxy and DNS logs for requests to the hard-coded webhook address.

Exposed credentials should be rotated from a clean system. Teams should also audit Azure identities, review sign-in and activity logs, and inspect GitHub Actions workflows that deploy to Azure. A continuous integration, or CI, pipeline automatically builds or deploys software, so a compromised runner can expose credentials used by unattended development work even when no employee directly opens the malicious package.

OX Security said the incident shows how attackers are targeting the AI developer ecosystem and the CI pipelines behind it. The organisation said the attacker appears to have found a way to hijack the wheel creation flow, the process that builds Python package files, and insert malicious logic into an official Microsoft-related package. That explanation describes an apparent method, not a confirmed account of how publishing access was obtained.

This is the second Microsoft-related PyPI package reported as compromised in 2026. In May, threat actors behind TeamPCP pushed three malicious versions of durabletask, Microsoft’s Python client for the Durable Task workflow execution framework, to distribute the Mini Shai-Hulud worm. For organisations running Python workloads, AEU-I’s security-first IT, infrastructure and consulting is relevant to reviewing affected development and cloud environments after this type of supply-chain incident.

Also available in: DeutschItalianoShqip