Security & privacy

Microsoft agent-framework PyPI package compromised to steal cloud credentials

Attackers published malicious versions 1.26.1 and 1.26.2 of Microsoft's agent-framework on November 17, 2026, injecting credential-stealing code that runs on every Python start.

A transparent Python logo cube containing a dark hook, resting on a server rack with glowing data lines.
Illustration generated for this article

Threat actors compromised the official Microsoft agent-framework package on the Python Package Index (PyPI) on November 17, 2026. The attackers released two malicious versions, 1.26.1 and 1.26.2, which were designed to silently harvest cloud credentials and environment data from any system where the package was installed. Both releases have since been quarantined by PyPI administrators.

What happened

The incident involves the agent-framework meta-package, which serves as the entry point for Microsoft Agent Framework, an open-source tool for building AI agents in Python. Security firms including Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity, and Wiz reported the compromise. The malicious versions were published just 33 minutes apart on the evening of November 17, 2026. It remains unclear how the attackers gained publishing access to the official repository.

Once installed, these packages did not require explicit importation to execute their payload. Instead, they dropped a .pth file into the site-packages directory. Python interpreters automatically execute import statements found in .pth files upon startup. This mechanism ensured that the credential stealer ran every time the Python interpreter launched in an affected environment, including during pip operations, regardless of whether the agent-framework was actively used in the script.

The first version, 1.26.1, used a file named agent_framework_meta.pth to trigger the theft. The second version, 1.26.2, used af_runtime_diag.pth and expanded its capabilities. Both versions collected sensitive data and exfiltrated it to a hard-coded webhook.site endpoint. Given that the package sees approximately 190,000 downloads per month, the potential exposure window was significant, though the malicious versions were only available for a short period.

How it works

The attack relied on Python’s standard site customization mechanism. By placing a .pth file in the site-packages root, the attackers leveraged a feature intended for path configuration to execute arbitrary code at interpreter startup. In version 1.26.1, the .pth file imported a module named agent_framework_meta, which launched the stealer. Version 1.26.2 imported af_runtime_diag.py, which added support for harvesting GitHub Actions OIDC tokens and broadened the search patterns for environment variables.

The stealer targeted a wide array of credentials. It scanned for environment variables using substring matching and read credential files from common locations, including Azure CLI configurations, .npmrc, pip.conf, .netrc, .git-credentials, Docker configs, and Hugging Face tokens. Crucially, it did not just read static files; it actively requested new tokens from cloud providers. In Azure DevOps pipelines, it used SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI to request federated tokens. On Azure compute instances, it queried the managed identity endpoint via IDENTITY_ENDPOINT or MSI_ENDPOINT, and fell back to the Azure Instance Metadata Service (IMDS) at 169.254.169.254 for other resources.

Collected data was compiled into a JSON document, compressed with zlib, encoded in Base64, and sent via HTTPS POST to a specific webhook.site URL. This method allowed the attackers to bypass simple text-based filters and efficiently transmit large amounts of stolen metadata and tokens.

Key details

  • Malicious versions: 1.26.1 and 1.26.2, published on November 17, 2026, between 8:35 and 9:20 p.m. UTC.
  • Persistence mechanism: Uses .pth files (agent_framework_meta.pth and af_runtime_diag.pth) to execute code on every Python interpreter start.
  • Data targets: Azure CLI creds, .npmrc, pip.conf, .netrc, .git-credentials, Docker configs, Hugging Face tokens, and .env files.
  • Active token theft: Requests new Azure DevOps OIDC tokens and Azure managed-identity tokens from live endpoints.
  • Exfiltration destination: Hard-coded webhook.site URL (webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb).
  • Safe version: Users should pin to version 1.26.0, which is confirmed clean.

Why it matters

This incident highlights the fragility of the software supply chain, particularly for high-profile open-source projects. Even official packages from major vendors like Microsoft are vulnerable if publishing pipelines are compromised. For developers building AI agents, this creates a direct risk to cloud infrastructure. The stealer’s ability to request new tokens means that rotating static secrets after detection may not be sufficient if the attacker has already established a foothold using federated identities or managed services.

The use of .pth files for persistence is particularly insidious because it operates below the level of typical application logic. Developers might audit their code for suspicious imports but miss files that execute before their code even runs. This affects CI/CD pipelines heavily, as any runner installing the package becomes compromised immediately. Since the package is a meta-package for AI orchestration, it is likely present in many development and production environments, increasing the blast radius.

What you can do

  • Pin the agent-framework package to version 1.26.0 in your requirements.txt or pyproject.toml files immediately.
  • Isolate any hosts or CI runners that may have installed versions 1.26.1 or 1.26.2 between 8:35 and 9:20 p.m. UTC on November 17, 2026.
  • Search your proxy, firewall, and DNS logs for outbound requests to the specific webhook.site URL mentioned in the reports.
  • Rotate all credentials that may have been exposed, including Azure CLI tokens, GitHub Actions secrets, and Docker registry passwords, from a known clean system.
  • Audit Azure Active Directory sign-in logs and activity logs for unusual token requests or access patterns originating from your development accounts.
  • Review GitHub Actions workflows that deploy to Azure to ensure no unauthorized federated credentials were issued during the exposure window.
  • #supply chain security
  • #python
  • #cloud security
  • #pypi
  • #microsoft
  • #credential theft

Tools from the Bytechap store

Keep reading

All stories