Skip to main content
Emerging ThreatsMalware & Ransomware

Microsoft's Agent Framework Package Exploited to Steal Cloud Credentials

A workstation with a laptop and Python books on a clean desk near a window.

"Both versions install Python startup hooks that silently collect credentials, environment data, and cloud identity tokens, then exfiltrate them to a webhook[.]site endpoint," Socket said in a report.

Malicious startup hooks in agent-framework 1.26.1 and 1.26.2

On November 17, 2026, threat actors published two malicious releases of Microsoft's agent-framework PyPI package — versions 1.26.1 and 1.26.2 — 33 minutes apart. Agent-framework is the meta-package for Microsoft Agent Framework, an open-source framework for building and orchestrating artificial intelligence agents in Python. As of this report, both malicious releases have been quarantined on the Python Package Index (PyPI) repository.

Persistence and automatic execution via .pth files

Both wheel files place a .pth file in the site-packages root that Python executes on every interpreter start. Endor Labs described the mechanism plainly: "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."

The .pth filenames differ by release: agent_framework_meta.pth for 1.26.1 and af_runtime_diag.pth for 1.26.2. The first contains a single import statement referencing agent_framework_meta, which launches the credential-stealing payload whenever the interpreter starts.

What the malware harvests and where it sends the data

The stealer is broad in scope. It collects environment variables matched by substring rules and harvests credential files including Azure CLI files (~/ .azure/*.json), .npmrc, pip.conf, .netrc, .git-credentials, Docker config.json, Hugging Face credentials, Microsoft Azure DevOps agent files, and .env and JSON files. It can read Azure DevOps OIDC tokens, Azure managed-identity tokens, and query Azure instance metadata — retaining up to 8,000 characters of the response.

SafeDep summarized a critical escalation vector: "Besides reading credentials already on disk, the code asks the platform to issue new ones." In Azure DevOps pipelines the malware can use SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI to request a federated token for api://AzureADTokenExchange. On Azure compute it attempts to request access tokens from the managed identity endpoint, using IDENTITY_ENDPOINT or MSI_ENDPOINT on App Service and Functions and 169.254.169[.]254 elsewhere for instance metadata.

All harvested data is collected into a JSON document, compressed with zlib, Base64-encoded, and exfiltrated via an HTTPS POST to a hard-coded URL: webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb.

Timeline, scale, and prior incidents

The malicious versions were published on November 17, 2026; the advisory window for exposure runs approximately between 8:35 and roughly 9:20 p.m. UTC on that date. The agent-framework package attracts about 190,000 downloads per month, amplifying potential reach. It remains unclear how the attacker obtained publishing access to push these wheels.

This incident is not the first Microsoft-related PyPI compromise in 2026: in May 2026, actors attributed to TeamPCP pushed three malicious versions of durabletask, Microsoft's Python client for the Durable Task workflow framework, distributing the Mini Shai-Hulud worm.

What this means for AI developers, CI/CD runners, and cloud identity owners

  • AI developers and package consumers: Developers using agent-framework or layered environments should assume any Python interpreter start in an affected environment could have executed the stealer; restoring from a clean environment and pinning to a known good version is essential.
  • CI/CD runners and DevOps engineers: Because the stealer executes on interpreter launch and can harvest Azure DevOps and GitHub Actions OIDC tokens, CI runners and deployment workflows are high-risk. OX Security warned the incident "shows how attackers are targeting the AI developer ecosystem and the CI pipelines behind it."
  • Cloud identity and platform owners: The code's ability to request new tokens from managed-identity endpoints and to query instance metadata means rotating stored secrets alone is insufficient. SafeDep noted that asking the platform to issue new credentials is part of the malware's behavior, so auditing identities and reviewing sign-in and activity logs is necessary.

Immediate actions advised for affected users

  • Isolate affected hosts and runners.
  • Pin the package to the most recent safe version (1.26.0) and restore environments from a clean source.
  • Check for exposure to the malicious releases between 8:35 and roughly 9:20 p.m. UTC on November 17, 2026.
  • Search proxy and DNS logs for requests to webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb.
  • Rotate any exposed credentials from a clean system.
  • Audit Azure identities and review sign-in and activity logs.
  • Audit GitHub Actions workflows that deploy to Azure.

The incident underlines a persistent risk for open-source supply chains: a single compromised release can install code that runs automatically across many environments and requests fresh cloud credentials from platform endpoints. Both the breadth of data exfiltrated and the mechanism — interpreter-start persistence via .pth files — raise a pointed technical question that remains unanswered by the record: how did the attackers obtain publishing access to inject malicious wheels into an official package?

Original story