Back

Microsoft's official Python agent framework hijacked to distribute malware
SiTech AI Team2 min read

Microsoft's official Python agent framework hijacked to distribute malware

Microsoft's official agent-framework package on PyPI has been hijacked to install info-stealing malware, researchers say, with versions 1.26.1 and 1.26.2 exfiltrating credentials and tokens.

Microsoft’s official agent-framework package on PyPI has been hijacked to install info-stealing malware, according to multiple security research firms. The affected versions, 1.26.1 and 1.26.2, exfiltrate environment variables, credential files, and other secrets for Azure, Git, Docker, Hugging Face, and other sensitive developer services. Microsoft's agent-framework GitHub repository is offline while the company investigates.

Affected versions and exposure

Researchers reported the problem late yesterday and this morning. The package is Microsoft’s agent-framework for Python, which boasts nearly 200,000 downloads a month and is used to build and deploy AI agents. OX Security said version 1.26.1 was reverted to a safe version, but the attacker later uploaded 1.26.2 through Microsoft’s official PyPI publisher account. That suggests the credentials had not been locked down at the time of the report. If either version is found in an environment, researchers say it should be assumed that account security work is needed.

How the malware operates

The package does not need to be imported to run. All it takes is a Python interpreter with the package installed to start up. The infected package still pulls the genuine 1.26.0 version of Microsoft’s agent-framework to keep itself running and looking legitimate. In the background, it gathers credentials, encrypts them as a base64-encoded chunk of JSON, and sends them to a webhook.site address hard coded into the malware. The malware is not persistent and only runs as long as the malicious version remains in a site-packages directory. It also requests fresh identity tokens from GitHub Actions, Azure DevOps, and Azure itself, which are exfiltrated to the same webhook site. Researchers at OpenSourceMalware said that combination of passive theft and active token requests makes it especially dangerous in cloud build environments, because even short-lived tokens are useful when they are exfiltrated right away.

GitHub repositories and Microsoft response

The agent-framework GitHub repository is offline as of writing. It has been pointed out online that Microsoft’s repository for ONNX Runtime, an AI accelerator, is also offline. Other Microsoft repositories remain available, and neither Microsoft nor security researchers have linked the ONNX repository’s pull to the malware campaign. A Microsoft spokesperson told The Register: “We have made some repositories private while we investigate malicious content. Our priority is to protect customers and the broader ecosystem. We are working to review and will take further action as needed.” The article was updated at 1805 with comment from Microsoft.

Sources: The Register

SiTech

SiTech — AI-powered web development

We build fast, modern websites and bring AI into real business workflows. Have a project or a question? We'd love to help.