Developers Could Have Their Passwords and API Keys Stolen by Malicious Microsoft AI Updates, Researchers Warn

Versions 1.26.1 and 1.26.2 used Python startup files to collect sensitive data from affected development environments.

Laptop displaying code under neon lighting
A laptop displaying code, similar to the environments targeted by the malicious Python package Daniil Komov / Unsplash

Two malicious releases of Microsoft's Agent Framework Python package were published to the Python Package Index (PyPI), a public repository for Python software. The releases were available for short periods, potentially exposing developers' credentials, API keys and cloud authentication tokens.

The releases used the name of Microsoft's genuine package. Versions 1.26.1 and 1.26.2 contained malicious code that could collect sensitive information whenever Python subsequently started in an affected environment, even if developers never used the framework.

Wiz said it reported its findings to Microsoft on 17 November. A maintainer of the Agent Framework project said the releases had been removed from PyPI and an investigation was underway, SecurityWeek reported.

Malicious Microsoft Agent Framework Releases Found on PyPI

Microsoft Agent Framework is an open-source toolkit for building AI agents and multi-agent applications.

Wiz said version 1.26.1 was published to PyPI at 20:35 UTC on 17 November, followed by version 1.26.2 at 21:08 UTC. Both were unavailable by 21:30 UTC, according to the researchers. JFrog's separate analysis reported that both had been removed by 21:16 UTC.

Version 1.26.0 and earlier were unaffected. Unlike legitimate releases, the malicious versions were distributed only as installable wheel files, without accompanying source distributions.

Wiz believes the attackers may have compromised a client certificate and private key associated with Microsoft's Engineering System Release Pipeline (ESRP), which is used to sign and publish software.

Wiz said an initial publishing attempt from an AWS environment was rejected, but a later attempt from Microsoft-owned IP space succeeded. The researchers found no corresponding malicious code in Microsoft's main source repository, suggesting the packages may have been uploaded outside the normal release process.

JFrog's separate analysis found signs that the malicious packages had been repacked locally rather than built through Microsoft's normal release pipeline. How the attackers obtained the publishing credentials remains unknown.

How the Malware Stole Developer Credentials

The malicious code used .pth files, which can make Python run additional instructions when it starts. This meant the malware could operate without developers importing or using the compromised framework.

The two releases used different startup files, with the second version expanding the malware's ability to collect sensitive information.

According to Wiz, the malware searched environment variables, configuration files and information held by other running processes. It targeted credentials linked to Azure, Azure DevOps, Git, Docker, package registries and AI services, including Hugging Face.

The second release also added the ability to steal GitHub Actions OpenID Connect (OIDC) tokens. These could be exchanged for Azure access if an Entra ID federated credential trusted the affected repository and workflow. The malware targeted workflows with the id-token: write permission, which allows them to request OIDC tokens.

The stolen information was compressed and sent in a single HTTPS request to a specific URL on webhook.site, a public service that receives and logs web requests.

Wiz Identified Three Successful Cases of Data Exfiltration

Wiz analysed 50 requests retained by the webhook.site URL used by the attackers. The service's free tier limited the number of requests stored, meaning the findings do not establish the total number of affected environments.

Four requests originated from the attackers' machines and the attack process, while 29 appeared linked to sandbox environments, vendor scanning and tests. The remaining 17 represented three unique cases of successful victim-data exfiltration.

What Should Developers Do If They Installed the Malicious Releases?

Developers who installed versions 1.26.1 or 1.26.2 should treat their affected environments and accessible credentials as potentially compromised. GitHub's security advisory identifies version 1.26.0 and earlier as unaffected.

Wiz recommends checking project files, development environments, CI logs and container images for the malicious versions. Developers should also look for the malware's startup files and remove affected environments.

JFrog warned that running pip uninstall directly in an infected environment could trigger the malicious code again. Developers should follow the security researchers' cleanup guidance before attempting to remove the package.

Projects should be pinned to version 1.26.0, the last known safe release. Developers should rotate potentially exposed credentials, including API keys, cloud tokens and Git credentials.

Organisations should also review Azure and GitHub activity logs for suspicious access and check network logs for connections to the specific webhook.site URL used in the attack. Affected environments should be rebuilt using verified packages.