Skip to main content
Editorial poster: the headline and key figures behind this report. Illustration: SecurityXP

Malicious Microsoft agent-framework Releases on PyPI Run a Credential Stealer on Every Python Start

· 4 min read · SecurityXP

Key Facts

  • Versions 1.26.1 and 1.26.2 of agent-framework were published to PyPI 33 minutes apart on November 17, 2026, and both ship a credential stealer designed to run on every Python start.
  • The stealer is delivered through agent_framework_meta.pth in version 1.26.1 and af_runtime_diag.pth in version 1.26.2; Python executes import lines in .pth files on every interpreter start, including pip itself.
  • Collected data includes environment variables matched by substring, credential files such as ~/.azure/*.json, .npmrc, pip.conf, .netrc, .git-credentials, .docker/config.json, Hugging Face credentials, Azure DevOps agent files, and .env and JSON files.
  • Version 1.26.2 adds a new top-level module, af_runtime_diag.py, collects GitHub Actions OIDC tokens, and expands the search patterns used for harvesting credential-related environment variables.
  • The payload harvests Azure DevOps OIDC tokens and Azure managed-identity tokens, queries Azure instance metadata, and retains up to 8,000 characters of the response.

Versions 1.26.1 and 1.26.2 of agent-framework, the meta-package for Microsoft Agent Framework, were published to PyPI 33 minutes apart on November 17, 2026. Both versions ship a credential stealer that is designed to run on every Python start.

That detail is what separates this incident from a conventional malicious package. The payload does not wait for a developer to import Agent Framework, and it does not depend on the package being used in code at all. It is tied to Python’s own startup behaviour, which means the exposure begins the moment an affected environment launches an interpreter.

Reporting on the compromise comes from multiple security firms, including Aikido, StepSecurity, Wiz, Chainguard, SafeDep, Endor Labs and Socket.

The startup hook mechanism

The persistence lives in two .pth files. Version 1.26.1 installs agent_framework_meta.pth; version 1.26.2 installs af_runtime_diag.pth. The agent_framework_meta.pth file contains a single import statement referencing agent_framework_meta, which then launches the stealer payload.

The reason this works is well understood Python behaviour. 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.

For defenders, the practical consequence is that the usual question, did anyone use the package?, is the wrong one. The relevant question is whether an affected version was ever present in an environment where Python ran, because that is the trigger condition.

What the stealer collects

The payload captures environment variables using substring-based matching, and it reads credential files already on disk. The file targets identified in reporting are:

  • Azure CLI credential files (~/.azure/*.json)
  • .npmrc
  • pip.conf
  • .netrc
  • .git-credentials
  • .docker/config.json
  • Hugging Face credentials
  • Microsoft Azure DevOps agent files
  • .env and JSON files

Beyond on-disk files, the stealer harvests Azure DevOps OIDC tokens and Azure managed-identity tokens. It also queries Azure instance metadata and retains up to 8,000 characters of the response.

The token theft is the part worth dwelling on. “Besides reading credentials already on disk, the code asks the platform to issue new ones,” SafeDep said. A stealer that only reads files captures what happens to be present at that moment; a stealer that requests tokens from the platform can obtain credentials that were never written to disk in the first place.

What changed in 1.26.2

Version 1.26.2 is not a simple re-release of the same payload. It imports a new top-level module, af_runtime_diag.py, collects GitHub Actions OIDC tokens, and expands the search patterns used for harvesting credential-related environment variables.

The additions point at automation rather than at individual developer laptops. GitHub Actions OIDC tokens and Azure DevOps artefacts are the material of CI/CD pipelines, and broader environment-variable matching widens the net for secrets injected at build or deploy time.

Two releases 33 minutes apart also indicate iteration by the attacker rather than a single accidental upload, a first payload followed quickly by a widened one.

What operators should do

The remediation problem here is larger than version pinning. Because the .pth hook fires on any interpreter launch, a compromised environment can re-exfiltrate on subsequent pip invocations until the malicious files are removed. Pinning the package to a safe release does not clean an already-poisoned site-packages directory.

A defensible sequence for anyone who may have installed 1.26.1 or 1.26.2:

  1. Identify affected environments, including CI runners and container images, not just developer machines.
  2. Isolate affected hosts and runners rather than continuing to run workloads on them.
  3. Remove the malicious .pth files and the associated modules, or rebuild the environment from a clean base.
  4. Treat every secret reachable from the affected environment as exposed, environment variables, the credential files listed above, and any token the platform could have issued on request.
  5. Review CI job logs and pipeline history for Python launches during the exposure window, since the trigger does not require the package to be imported.

The fourth point is the one most easily under-scoped. Because the payload requests tokens from the platform in addition to reading files, the blast radius is set by what the environment’s identity was permitted to obtain, not only by what was sitting on disk. That includes managed identities and OIDC trust relationships, which typically outlive a single build.

The .pth vector is also a reminder that install-time trust decisions in Python extend past the import graph. A package that executes at interpreter startup exercises control over every process that starts an interpreter in that environment, including the package manager used to remove it.

Tags: supply chain PyPI credential theft Microsoft Agent Framework Python CI/CD security

Sources & References

S SecurityXP
SecurityXP Cybersecurity News & Analysis

SecurityXP delivers cybersecurity news, vulnerability analysis, data breach reports, and threat intelligence.

Security Digest

The most important cybersecurity stories, CVE alerts, and threat intelligence — one concise email. Unsubscribe anytime.

Related Articles

Process diagram of the software supply chain: Signup field input through Brand sites served, with the fault at Signup field input.
Vulnerabilities & Exploits

Optimizely Signup-Flow Vulnerability Injected Malicious JavaScript Into Sites of 178 Organizations

Optimizely confirmed that the attacker exploited a vulnerability in its Experimentation account signup flow.

Process diagram of the software supply chain: Paid contributors through Program ended, with the fault at AI-drafted PRs.
Technology

ESLint's Payout Program Ended Over AI-Generated Code

ESLint ended its paid contributor program after AI-generated pull requests overwhelmed volunteer review capacity — a supply-chain integrity signal with downstream consequences.

Impact map: npm supply chain risk at the centre, connected to npm, openssf, supply chain security and Defensive.
Cloud Security

Feds & npm Issue Supply Chain Security Guidance

Faster development times, innovation, and a thriving open-source community have all been made possible by the ability to use another developer's project as a dependency. With many JavaScript projects

Process diagram of the exploitation chain: Auth Bypass through Arbitrary Code, with the fault at Auth Bypass.
Threat Intelligence

Ivanti EPMM Malicious Listener Malware Analysis

U.S. Cybersecurity and Infrastructure Security Agency’s new Malware Analysis Report on a malicious listener deployed on Ivanti Endpoint Manager Mobile (EPMM) systems by chaining CVE-2025-4427 and C...