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 importedagent_framework_meta. Its initialization invoked the malicious_telemetry._start()function.Version 1.26.2: Introduced
af_runtime_diag.pth, which imported the top-level moduleaf_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:
Malicious package publication: Attackers published trojanized versions
1.26.1and1.26.2ofagent-frameworkto PyPI.Package installation: Developers or automated pipelines installed one of the affected releases.
Automatic execution: Python startup
.pthfiles triggered the malicious code whenever an interpreter initialized.Credential discovery: The malware searched environment variables, process environments and local credential files.
Cloud identity targeting: Azure managed identities and Azure DevOps authentication tokens were targeted.
GitHub Actions targeting: Version
1.26.2added collection of GitHub Actions OIDC tokens when workflows permittedid-token: write.Data staging: Collected credentials and system information were combined into JSON, compressed and Base64-encoded.
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:
TOKENSECRETPASSWORDKEYAZUREAWSGITHUBOPENAINPMPIPNUGETSYSTEMBUILDAGENT
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 |
|
User-Agent |
|
User-Agent |
|
Host-based indicators
Type | Indicator | Associated version |
|---|---|---|
Startup file |
| 1.26.1 |
Python module |
| 1.26.1 |
Startup file |
| 1.26.2 |
Python module |
| 1.26.2 |
Environment variable |
| Both versions |
File hashes
Algorithm | Hash | File |
|---|---|---|
SHA-1 |
|
|
SHA-256 |
|
|
SHA-256 |
|
|
SHA-256 |
|
|
SHA-256 |
|
|
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
Identify installations of
agent-frameworkversions1.26.1and1.26.2across developer workstations, virtual environments, containers and CI/CD pipelines.Downgrade or pin the package to version
1.26.0, identified by Wiz as the latest safe release at the time of publication.Inspect Python
site-packagesfor the malicious.pthfiles and associated Python modules.Search network, DNS and proxy logs for the reported webhook.site endpoint.
Rotate credentials accessible to affected environments, including Azure CLI sessions, Azure DevOps tokens, Git credentials and package-registry tokens.
Review Azure managed-identity activity and federated credential sign-ins.
Investigate GitHub Actions workflows that installed version
1.26.2withid-token: write.Rotate repository and organization secrets exposed to affected workflows.
Rebuild affected CI/CD runners and developer environments from trusted images where system integrity cannot be established.
Review access to Azure Key Vault, Storage, Microsoft Graph and other cloud resources.
Preventive Actions
Enforce dependency pinning and package integrity verification.
Use trusted package repositories and controlled dependency sources.
Validate package provenance against official source repositories and release artifacts.
Apply least-privilege permissions to managed identities and CI/CD service accounts.
Restrict GitHub Actions
id-token: writepermissions to workflows that genuinely require them.Limit federated identity trust to approved repositories, branches and workflows.
Use ephemeral CI/CD runners to reduce the persistence of compromised build environments.
Monitor Python startup directories for unexpected
.pthfiles.Implement outbound network monitoring for unusual webhook and data-exfiltration activity.
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.
