Microsoft has confirmed that its official Python agent-framework package was compromised, leading to the distribution of malicious code through the Python Package Index (PyPI). The incident involved the unauthorized upload of versions 1.26.1 and 1.26.2, which were pushed to the repository using Microsoft’s official publisher account. Security researchers identified the breach, noting that the malicious activity appears to stem from a compromise of administrative credentials within Microsoft’s GitHub organization.
The affected package, which is widely utilized by developers to build and deploy AI agents, typically sees nearly 200,000 downloads per month. The malicious code is designed to execute immediately upon the package being installed in a Python environment, even if the library is not explicitly imported by the user. To maintain a facade of legitimacy and ensure the software continues to function as expected, the infected versions still pull the genuine 1.26.0 release of the framework.
Once active, the malware performs both passive and active credential harvesting. It scans the host environment for existing secrets, including credential files and environment variables associated with Azure, Docker, Git, and Hugging Face. Furthermore, the script actively requests new identity tokens from Azure, Azure DevOps, and GitHub Actions. These stolen credentials and tokens are encrypted as base64-encoded JSON objects and exfiltrated to a hard-coded webhook address.
The nature of this attack makes it particularly dangerous for automated cloud build environments. Because the malware exfiltrates tokens immediately upon request, it can successfully capture short-lived credentials before they expire, granting attackers potential access to sensitive development infrastructure. The malware does not establish persistence on the infected machine; its malicious operations cease if the compromised package is removed from the site-packages directory.
In response to the discovery, Microsoft has taken several of its GitHub repositories offline, including the agent-framework and the ONNX Runtime project. While the company has confirmed that these repositories were set to private as part of an ongoing investigation into malicious content, it has not officially linked the status of the ONNX Runtime repository to the specific agent-framework attack.
Microsoft has stated that its primary objective is the protection of its customers and the broader software ecosystem. The company is currently reviewing the incident and has indicated that it will take further corrective actions as necessary. At this time, the agent-framework GitHub repository remains inaccessible to the public.
Security analysts advise that any organization currently running versions 1.26.1 or 1.26.2 of the Microsoft agent-framework should treat their environment as compromised. Given the capability of the malware to exfiltrate active identity tokens, affected parties are encouraged to rotate all credentials and secrets that may have been present in the build environment where the package was installed.




