Microsoft's Python AI agent package hijacked on PyPI to steal developer credentials
Researchers have found that Microsoft's official agent-framework package on PyPI, the main repository for Python software, was hijacked and now installs malware that steals credentials. Several security research firms reported the problem, which affects versions 1.26.1 and 1.26.2. The package is used to build and deploy AI agents and has nearly 200,000 downloads a month.
According to OX Security, version 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 had not been locked down at the time of the report. The Register reports this appears to involve unauthorised access to an administrator account on Microsoft's GitHub organisation. Microsoft had not responded to questions at the time of writing.
The malware does not need the package to be imported. Simply having it installed in a Python environment is enough for it to run when Python starts. It also pulls in the genuine 1.26.0 version of the framework, so the software keeps working and looks legitimate. In the background it gathers environment variables and credential files for services including Azure, Git, Docker and Hugging Face. It packages them as base64-encoded JSON and sends them to a hard-coded webhook.site address.
The malware also actively requests fresh identity tokens from GitHub Actions, Azure DevOps and Azure, and sends those to the same address. OpenSourceMalware researchers said this combination makes it especially dangerous in cloud build environments, because even short-lived tokens are useful if stolen immediately. The malware is not persistent and only runs while the malicious version stays in the site-packages directory. The agent-framework GitHub repository is offline, and Microsoft's ONNX Runtime repository is also offline, though no one has linked that to this campaign.
Why it matters
Any team building AI agents with this package, especially in CI/CD pipelines with cloud identity access, is exposed, and trusting a package because it comes from the vendor's official publisher account proved insufficient here. Because the malware runs without being imported and requests fresh tokens, removing the package is not enough: rotating secrets and reviewing token activity becomes a required decision. Short-lived tokens do not protect you if they are exfiltrated and used immediately.
What to do
- Search your environments and build systems for agent-framework versions 1.26.1 and 1.26.2.
- Rotate Azure, Git, Docker, Hugging Face and other credentials that were present on any affected machine or pipeline.
- Review GitHub Actions, Azure DevOps and Azure token activity for unexpected use.
- Look for outbound connections to webhook.site from developer and build systems.