Attackers briefly hijacked Microsoft's official Agent Framework package on PyPI and used it to distribute credential-stealing malware capable of harvesting cloud tokens, developer secrets and CI/CD credentials from developer workstations and automated build systems, according to multiple security researchers. Two malicious versions of the package, 1.26.1 and 1.26.2, appeared on PyPI on November 17 and stayed live for less than an hour.
OX Security, one of several security firms that flagged the releases, said in a blog post that the package "is a credential stealer: it harvests environment secrets, cloud and package-manager credentials, and Azure managed identity tokens, then exfiltrates them to an attacker-controlled webhook." The payload ran automatically every time Python started, even if no code imported the package, OX said. The malicious versions also installed the genuine framework code, so applications kept working, and the compromise was easy to miss. The package has 192,534 monthly downloads, according to the firm. Aikido Security, Endor Labs and SafeDep published similar analyses.S1S2
The stealer collected environment variables with names containing words such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB and OPENAI, OX said. It read up to 60 credential files, including Azure CLI settings, Git and Docker credentials, npm and pip configuration, Hugging Face tokens, Azure DevOps build agent credentials and application .env files, and pulled secrets from up to 300 other running processes. Inside Azure DevOps pipelines it requested an identity token that can be exchanged for Azure access, and it requested managed identity tokens for services including Resource Manager, Microsoft Graph, Key Vault, Storage, Cognitive Services, AI Foundry and Azure DevOps.S1S2
Endor Labs said the attack was aimed mainly at automated build systems. "Developer laptops are in scope, but the payload is written for CI runners and Azure workloads," the firm wrote. The code sat in a module named _telemetry.py disguised as diagnostics, sending data with a user agent labeled "af-runtime-diagnostics" to a webhook.site address as compressed, encoded JSON.S1S2
The attacker did not stop after the first release. While OX was researching the malware, version 1.26.1 was reverted to the clean 1.26.0, and the attacker then uploaded 1.26.2, which used a different file path for the same payload. According to Aikido Security, the first version went up at 20:35 UTC and the second at 21:08 UTC, and both were gone by about 21:20 UTC. Microsoft has not said publicly how the attacker gained access to publish the package and did not immediately respond to a request for comment.S1S2