Osegi
Security·2 min read

Microsoft agent-framework on PyPI hijacked to steal secrets

Two versions of Microsoft's Python agent-framework on PyPI carried info-stealing malware that runs without the package ever being imported.

A Python package icon with a broken padlock over lines of code, symbolising a compromised software package.
Image: theregister

If you installed Microsoft's Python agent-framework package recently, check which version you got. Versions 1.26.1 and 1.26.2 on PyPI, the main Python package repository, have been hijacked and install malware that steals developer credentials.

Security researchers reported the problem late on Tuesday and this morning. According to OX Security, 1.26.1 was reverted to a safe version, but the attacker then uploaded 1.26.2 through Microsoft's official PyPI publisher account. That suggests the credentials were still not locked down when the report was written. The researchers point to what looks like unauthorised access to an administrator account on Microsoft's GitHub organisation.

What does the malicious agent-framework do?

The package is used to build and deploy AI agents and gets nearly 200,000 downloads a month. The bad versions collect environment variables, credential files and other secrets for Azure, Git, Docker, Hugging Face and other developer services. The data is packed into base64-encoded JSON and sent to a webhook.site address hard coded into the malware.

You never have to import the package. Simply having it installed is enough, because it runs whenever a Python interpreter starts. It also pulls in the genuine 1.26.0 release so everything keeps working and looks normal.

The malware also asks for new identity tokens from GitHub Actions, Azure DevOps and Azure, and sends those to the same address. "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're exfiltrated right away," said researchers at OpenSourceMalware.

It is not persistent. It only runs while the malicious version sits in the site-packages directory.

What should you do?

If either version turns up in your environment, assume your secrets were exposed and rotate the credentials.

The agent-framework GitHub repository is offline. So is the repo for ONNX Runtime, an AI accelerator, though neither Microsoft nor the researchers have tied that to the malware campaign. A Microsoft spokesperson said the company made some repositories private while it investigates malicious content, and will take further action as needed.

Apps worth a look

SUMO: the number puzzle

Tap the right tiles, add them up, hit the target. Easy to learn, hard to master. Free, for all ages.

Tags:microsoftpypiagent-frameworkmalwaresupply chain attackgithub

More from this day

See all →

More in: Security

See all →