Microsoft’s Official Python Agent Framework Hijacked to Steal Cloud Credentials via PyPI

Two malicious versions of Microsoft’s agent-framework Python package, published Tuesday under Microsoft’s own PyPI publisher account, exposed a package downloaded close to 200,000 times a month to credential-stealing malware.

The versions, 1.26.1 and 1.26.2, were pulled from the Python Package Index within about an hour, but anyone who installed them in that window is at risk.

Researchers at cloud security company Wiz Inc. believe the attacker obtained publishing access with a client certificate and private key belonging to Microsoft’s Engineering System Release Pipeline, an internal service the company relies on to sign and publish packages.

Address filtering on the service blocked the attacker’s first attempt from Amazon Web Services, but the attacker succeeded on a second try from Microsoft-owned address space. How the credentials were obtained is not known.

Both releases included a .pth file containing the malware — a kind of file that Python executes each time it launches — so the credential stealer activates even when the framework is never imported. The malicious versions also kept the genuine agent-framework-core 1.26.0 as a dependency, which meant the framework kept operating as usual while the malware harvested secrets from environment variables and running processes, as well as credential files belonging to services including Azure, npm, Git, Docker and Hugging Face.

According to application security company Endor Labs Inc., it also sought Azure managed identity tokens for 12 resources, and the second version additionally requested GitHub Actions tokens. The stolen data was compressed, encoded and sent to a webhook.site address controlled by the attacker.

Microsoft's Agent Framework Was Hijacked on PyPI: Check Yours Now — Tallbyte

“A focused credential and token stealer, not a remote access trojan,” said researchers at malware tracking site OpenSourceMalware, noting that the malware installs no persistence on infected systems.

The victim count may be small. Wiz’s analysis covers only the 50 requests the attacker’s free webhook.site account retained, and of those, 17 represented just three unique successful thefts of victim data — the rest came from the attacker’s own machines and from sandbox and security vendor scanning.

The researchers also observed part of the operation directly: the attacker’s tooling, which identified itself as Cairn, an open-source AI-powered penetration-testing framework, was reporting its progress to the same public webhook it used to collect stolen data.

The agent-framework GitHub repository was offline as of The Register’s reporting, and the company’s repo for ONNX Runtime was down as well, though neither Microsoft nor researchers have linked that pull to the campaign.

Malicious Versions of Microsoft's AI Development Framework Published on PyPI
Photo: BigGo Finance

“We have made some repositories private while we investigate malicious content,” a Microsoft spokesperson told The Register. “Our priority is to protect customers and the broader ecosystem. We are working to review and will take further action as needed.”

It is not the first such incident this year. In May, Microsoft’s durabletask package was hijacked after its PyPI token was stolen, and three malicious versions spread the worm known as Mini Shai-Hulud. Wiz says it has not linked the two incidents.

Anyone who installed either malicious version is being urged to treat it as a credential compromise: rebuild from version 1.26.0 and rotate any secrets the affected systems could access. StepSecurity warns that simply running a pip command could reactivate the malicious code and calls for network isolation of affected environments and suspension of Python and pip execution until they are confirmed safe.

“A list of dependencies in production might show no trace of the framework, while a build runner could have installed it and been shut down before the alert arrived,” James Matchett, head of security at software supply chain security company Cloudsmith Ltd., told SiliconANGLE.

The company behind the framework traces its roots to April 4, 1975, when Bill Gates and Paul Allen founded Microsoft to market a BASIC interpreter for the Altair 8800 microcomputer — Allen suggested the name “Micro-Soft”, short for micro-computer software. Its 1986 initial public offering created three billionaires and an estimated 12,000 millionaires among its employees.

Today the Redmond, Washington-based company is the largest software maker by revenue and became the third publicly traded U.S. company to be valued at over $1 trillion, in April 2019. Under Satya Nadella, chief executive since 2014, it has shifted toward cloud computing, acquiring LinkedIn in 2016 and Activision Blizzard in 2023, and its Azure platform is among the very credentials the stolen data targeted.

“If that runner had access to a deployment token, the team needs to know which version it installed and what the token could access,” he added.

Photo of author

Technology Desk

Technology Desk at Archyde.

Chris Brown Raises Child Support to $12,000 Monthly After Court Filing

A resident with dementia was sexually assaulted at a care home in Greenock, Scotland