Two counterfeit releases of Microsoft's Python package for AI agents searched for cloud keys every time Python started
The infected versions were on PyPI for about an hour, and security firm Wiz found traces of three successful thefts from victims.
On the evening of Tuesday 17 November, versions 1.26.1 and 1.26.2 of agent-framework, Microsoft's official Python package for building AI agents, which is downloaded about 200,000 times a month, appeared on PyPI. Both contained a program that steals passwords and tokens, BleepingComputer reports. Because they still used the genuine core of the framework, applications kept working normally. According to Wiz, both versions were unavailable again by around 21:30 UTC, and 1.26.0 is the latest safe version.
The malicious code sat in a .pth file, which Python runs at every start, even if the package is never imported. It searched for secrets in environment variables, configuration files and other processes, including for Azure, AWS, GitHub, Docker and Hugging Face, and tried to obtain tokens from Azure managed identities and Azure DevOps. The second version also targeted GitHub Actions tokens and used different file names, so anyone searching only for the first could miss it. Everything was sent to an address at webhook.site.
How the attacker was able to publish is unknown. Wiz suspects that a Microsoft signing certificate was stolen. SecurityWeek reports that a project maintainer confirmed the removal and announced an investigation. Anyone who installed an affected version should rebuild the environment from a clean base and replace every key that was reachable there, the researchers advise.