ThreatBeaconXSubscribe
HighMalware · 6 min read

Malicious Python Package Turns Developer Environments Into Credential Theft Targets

A software supply-chain attack involving Microsoft's Python package agent-framework exposed developer environments, cloud infrastructure and CI/CD pipelines to credential theft. According to security research published by Wiz on November 17, 2026, two malicious package releases, versions 1.26.1 and 1.26.2, were uploaded to the Python Package Index (PyPI). Both releases contained malicious code designed to execute automatically when Python started in an affected environment. The attack used Python .pth startup files to trigger the credential-stealing payload, meaning developers did not need to explicitly import the compromised package for the malicious code to execute. The malware searched for sensitive environment variables, Azure CLI credentials, Azure DevOps tokens, GitHub Actions OIDC tokens, cloud managed-identity credentials and secrets stored in developer configuration files. Collected information was compressed, Base64-encoded and transmitted to an external webhook endpoint. The second malicious release expanded the attack to include GitHub Actions workload identity tokens and additional runner-related data. Wiz reported that both malicious versions were subsequently removed from PyPI and identified version 1.26.0 as the latest safe release at the time of its investigation. The exact root cause of the package compromise remained unconfirmed.

Written by Aswini Devi Medisetti·Published Nov 18, 2026

1.Description

The incident involved the distribution of malicious versions of Microsoft's Python Agent Framework through PyPI.

The compromised package was designed to collect authentication material from systems where developers, automated build processes or cloud workloads had installed the affected versions.

Unlike conventional malicious packages that execute their payload when imported by an application, these releases used Python startup mechanisms to initiate execution whenever an interpreter launched.

Wiz identified several irregularities in the package publication process. Version 1.26.1 was uploaded as a wheel without the corresponding source distribution, and the associated GitHub repository did not contain a matching release tag or the malicious implementation.

The legitimate release pattern also differed from the malicious publication because the compromised package depended on agent-framework-core version 1.26.0.

These observations suggest that the malicious package may have been built outside the normal release process. However, the precise compromise mechanism has not been confirmed.

2.Technical Description

The malicious releases used Python .pth files placed inside the installed package's site-packages directory.

Python processes eligible .pth startup instructions during interpreter initialization. Consequently, the malicious code could execute without an application explicitly importing agent-framework.

The two versions used different startup mechanisms:

  • Version 1.26.1: Introduced agent_framework_meta.pth, which imported agent_framework_meta. Its initialization invoked the malicious _telemetry._start() function.

  • Version 1.26.2: Introduced af_runtime_diag.pth, which imported the top-level module af_runtime_diag.py.

The malware also used telemetry-like naming conventions to make its functionality appear legitimate.

Its execution logic attempted to detach itself using os.setsid(), with a daemon-thread fallback in environments where process forking was unavailable. The _AF_TEL=1 environment variable was used to prevent repeated execution in child processes.

The collected information was assembled into a JSON document, compressed using zlib, encoded using Base64 and transmitted through an HTTPS POST request to an external webhook endpoint.

3. Attack Overview

The attack can be divided into the following stages:

  1. Malicious package publication: Attackers published trojanized versions 1.26.1 and 1.26.2 of agent-framework to PyPI.

  2. Package installation: Developers or automated pipelines installed one of the affected releases.

  3. Automatic execution: Python startup .pth files triggered the malicious code whenever an interpreter initialized.

  4. Credential discovery: The malware searched environment variables, process environments and local credential files.

  5. Cloud identity targeting: Azure managed identities and Azure DevOps authentication tokens were targeted.

  6. GitHub Actions targeting: Version 1.26.2 added collection of GitHub Actions OIDC tokens when workflows permitted id-token: write.

  7. Data staging: Collected credentials and system information were combined into JSON, compressed and Base64-encoded.

  8. Data exfiltration: The staged information was transmitted to an external webhook.site endpoint through HTTPS.

4. Technical Analysis

4.1 Malicious package execution

The use of .pth files allowed the malware to execute during Python interpreter initialization. This behavior is particularly significant because removing the package from an application's import statements would not prevent execution if the malicious startup file remained installed.

4.2 Credential collection

The malware searched environment variables containing terms associated with credentials and cloud services, including:

  • TOKEN

  • SECRET

  • PASSWORD

  • KEY

  • AZURE

  • AWS

  • GITHUB

  • OPENAI

  • NPM

  • PIP

  • NUGET

  • SYSTEM

  • BUILD

  • AGENT

It also inspected up to 300 process environment files under /proc/*/environ for sensitive values.

In version 1.26.1, the malware collected up to 60 credential files, including Azure CLI data, npm configuration, pip configuration, Git credentials, Docker configuration, Hugging Face tokens and Azure DevOps agent credentials.

4.3 Azure identity targeting

The malware attempted to retrieve Azure managed-identity tokens through the Instance Metadata Service (IMDS) or App Service identity endpoint.

The targeted resources included:

  • Azure Resource Manager

  • Microsoft Graph

  • Azure Key Vault

  • Azure Storage

  • Cognitive Services

  • Azure AI/ML

  • Azure Search

  • Azure Container Registry

  • Azure DevOps

  • AzureADTokenExchange

These tokens could provide access to cloud resources depending on the permissions assigned to the affected identities.

4.4 GitHub Actions OIDC theft

Version 1.26.2 expanded the collection functionality to target GitHub Actions environments.

When a workflow granted id-token: write, the malware attempted to request OIDC tokens for Azure-related audiences.

If an Entra ID federated credential trusted the affected repository and workflow, an attacker could potentially exchange the stolen token for Azure access without possessing a conventional stored client secret.

This increased the potential impact from developer workstations to automated build and deployment infrastructure.

4.5 Data exfiltration

The malware sent collected information through a hardcoded webhook.site endpoint.

Wiz reported that the attacker's webhook was using the free tier, which limited the number of requests and had a seven-day expiration for unattached URLs. The researchers confirmed that a maximum of 50 requests had been captured.

This limitation does not establish that all potentially exposed credentials were harmless or unusable.

5. Indicators of Compromise (IOCs)

Source-confirmed indicators

Network indicators

Type

Indicator

Exfiltration URL

hxxps://webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb

User-Agent

af-runtime-diagnostics/1

User-Agent

runtime-diagnostics/1

Host-based indicators

Type

Indicator

Associated version

Startup file

agent_framework_meta.pth

1.26.1

Python module

agent_framework_meta/_telemetry.py

1.26.1

Startup file

af_runtime_diag.pth

1.26.2

Python module

af_runtime_diag.py

1.26.2

Environment variable

_AF_TEL=1

Both versions

File hashes

Algorithm

Hash

File

SHA-1

0a013e4724c4437cf9b177def1d988113e167539

_telemetry.py

SHA-256

54d885b7d7161c9ed96489c66364c4bfbf635929166843bba10d97d46b5a2e1f

af_runtime_diag.py

SHA-256

325e7e9f0ec94e41ad1a1b7a3f18a6b8b5bffece2e2b97b8d3369eb967452f93

af_runtime_diag.pth

SHA-256

d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110

agent_framework-1.26.1-py3-none-any.whl

SHA-256

3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9

agent_framework-1.26.2-py3-none-any.whl

Source: Wiz Security Research.

6. Potential Impact

  • Cloud credential compromise: Exposure of Azure managed-identity tokens and Azure CLI authentication material.

  • CI/CD compromise: Theft of Azure DevOps and GitHub Actions authentication tokens.

  • Source-code exposure: Compromise of Git credentials and other developer authentication information.

  • Cloud resource access: Potential unauthorized access to Key Vault, Storage, Microsoft Graph and other Azure services.

  • Supply-chain propagation: Stolen publishing or repository credentials could create further opportunities for software supply-chain attacks.

  • Build environment compromise: Exposure of secrets in automated runners could affect application builds and deployment processes.

  • Long-term unauthorized access: Removing the malicious package alone does not invalidate credentials already stolen.

The actual impact depends on which environments installed the affected releases, what credentials were accessible and the permissions assigned to the compromised identities.

7. Recommendations

Immediate Actions

  1. Identify installations of agent-framework versions 1.26.1 and 1.26.2 across developer workstations, virtual environments, containers and CI/CD pipelines.

  2. Downgrade or pin the package to version 1.26.0, identified by Wiz as the latest safe release at the time of publication.

  3. Inspect Python site-packages for the malicious .pth files and associated Python modules.

  4. Search network, DNS and proxy logs for the reported webhook.site endpoint.

  5. Rotate credentials accessible to affected environments, including Azure CLI sessions, Azure DevOps tokens, Git credentials and package-registry tokens.

  6. Review Azure managed-identity activity and federated credential sign-ins.

  7. Investigate GitHub Actions workflows that installed version 1.26.2 with id-token: write.

  8. Rotate repository and organization secrets exposed to affected workflows.

  9. Rebuild affected CI/CD runners and developer environments from trusted images where system integrity cannot be established.

  10. Review access to Azure Key Vault, Storage, Microsoft Graph and other cloud resources.

Preventive Actions

  1. Enforce dependency pinning and package integrity verification.

  2. Use trusted package repositories and controlled dependency sources.

  3. Validate package provenance against official source repositories and release artifacts.

  4. Apply least-privilege permissions to managed identities and CI/CD service accounts.

  5. Restrict GitHub Actions id-token: write permissions to workflows that genuinely require them.

  6. Limit federated identity trust to approved repositories, branches and workflows.

  7. Use ephemeral CI/CD runners to reduce the persistence of compromised build environments.

  8. Monitor Python startup directories for unexpected .pth files.

  9. Implement outbound network monitoring for unusual webhook and data-exfiltration activity.

  10. Centralize cloud identity and CI/CD audit logs for continuous threat detection.

8. Conclusion

The compromise of Microsoft's agent-framework Python package demonstrates how software supply-chain attacks can bypass conventional application-level security controls.

By abusing Python startup mechanisms, the malicious releases were capable of executing without an explicit package import. Their credential-stealing functionality targeted developer environments, Azure infrastructure and CI/CD authentication systems.

The introduction of GitHub Actions OIDC theft in version 1.26.2 further increased the potential exposure of automated development and deployment workflows.

Organizations that installed either malicious release should treat accessible credentials as potentially exposed, rotate affected authentication material, investigate cloud identity activity and rebuild environments where necessary.

The incident reinforces the importance of package provenance validation, dependency integrity monitoring, least-privilege access and continuous security monitoring across software development pipelines.

MITRE ATT&CK Mapping

T1195.002 — Compromise Software Supply ChainT1059.006 — PythonT1005 — Data from Local SystemT1552.001 — Credentials In FilesT1552.005 — Cloud Instance Metadata APIT1528 — Steal Application Access TokenT1567.004 — Exfiltration Over Webhook