Bad actors used two malicious versions of Microsoft’s popular agent framework that included a credential-stealing payload that exfiltrates a range of information, environment secrets, cloud and package-manager CI/CD credentials, and Azure managed identity tokens.
The unknown attackers published the two now-quarantined malicious versions – 1.26.1 and 1.26.2 – in rapid succession on the Python Package Index (PyPI) on November 17, according to reports from several cybersecurity vendors, including OX Security, StepSecurity, Wiz, and Aikido.
“The attacker published two malicious wheels within 33 minutes,” Rohan Prabhu, founding software engineer of StepSecurity, wrote in a report, noting that the second was published fewer than three minutes after the first was quarantined. “This demonstrates that quarantining the first release did not immediately revoke the attacker’s publishing access. It does not establish whether that access remains available now.”
The malicious agent-framework versions are also the latest indicators of threat actors targeting the AI developer environment and the continuous integration (CI) pipelines that play a key role in it, according to Moshe Siman Tov Bustan, security research team lead for OX Security.
“While directly targeting an official Microsoft package, it seems that attackers found a way to hijack the wheel creation flow to add malicious logic inside,” Bustan wrote, pointing out that the second malicious version contained a different path for the same payload. “This attack isn’t just a one-off exfiltration attempt, but a planned, live and coordinated effort to reach as many victims as they can, while still being able to bypass blocks and restrictions.”
Microsoft’s agent framework is the official Python meta-package and SDK for the Microsoft Agent Package, an open-source framework developers can use to build and deploy AI agents and multi-agent workflows in the Python, .NET, and Go programming languages. The framework pulls together agents, harnesses, workflows, and integrations.
Microsoft’s Python package is a popular one, getting 192,534 downloads every month, according to OX Security.
“The payload runs automatically on every Python interpreter start – once the package is installed, without the package ever being imported,” he wrote. “Because it pulls in the genuine agent-framework-core 1.26.0 as a dependency, the framework keeps working normally, and the compromise is easy to miss.”
According to StepSecurity’s Prabhu, there’s nothing that shows the initial access vector for the attacker, nor the specific account or credential that was used or the identity of the malicious versions’ uploader. The package in both malicious versions, or wheels, drops a .pth file, which is automatically executed every time the interpreter starts. This means the credential-stealer runs whenever Python is started, even if the package itself isn’t explicitly imported.
“.pth startup hooks are an increasingly common PyPI malware technique because they decouple execution from any import of the compromised package,” he wrote. “A later launch of pytest, a Python build script, a linter, or pip in the affected environment can trigger the payload. Non-Python steps do not themselves trigger the hook, although a previously started collector may still be running.”
The lightly obfuscated payload not only collects a large and varied amount of data and credentials, it also tries to obtain fresh identity tokens for GitHub Actions OIDC, Azure DevOps OIDC, and Azure managed identity tokens. Such “token minting” is important, Prabhu wrote.
“Rotating static secrets does not necessarily invalidate already-issued identity tokens,” he wrote. “A stolen OIDC token may be exchanged while valid if the cloud provider accepts its claims. Removing or disabling the relevant federated trust can prevent future exchanges through that trust, but does not necessarily revoke access tokens already issued.”
Prabhu added that “continued token issuance also requires access to a valid workload or managed-identity context. Contain the workload, review service connections and role assignments, and monitor identity and resource-access logs throughout the exposure window.”
The information the payload collects is moved to a JSON document, compressed with zlib, Base64-encoded, and sent in a single request to a hard-coded webhook URL.
The security researchers are recommending that users isolate affected hosts, containers, and runners from the network, terminate malicious collector processes, rotate credentials from a clean system, and review identity access.
Recent Articles By Author