Attackers Hijack Microsoft’s Agent-Framework Package to Steal Cloud Credentials
Share
Attackers briefly hijacked Microsoft’s official agent-framework package on the Python Package Index (PyPI) to distribute malware designed to steal cloud tokens, developer secrets, and CI/CD credentials.
The incident, discovered on 17 November, involved two malicious versions of the package—1.26.1 and 1.26.2. Although the rogue releases were live for less than an hour, they were capable of harvesting sensitive information from developer workstations and automated build environments during that window.
Automated Credential exfiltration
The malicious payload was designed to run automatically every time Python started on an infected system, even if the agent-framework package was not explicitly imported by the running code. This persistence was achieved through the use of .pth files, which Python executes during site-packages initialisation.
Researchers at OX Security identified that the malware focused on environment variables containing sensitive keywords such as “SECRET”, “PASSWORD”, “AZURE”, “AWS”, and “OPENAI”. It also targeted up to 60 specific credential files, including configurations for Docker, Git, npm, and Hugging Face.
In automated environments, the stealer demonstrated advanced capabilities by requesting fresh Azure managed identity tokens. These tokens could provide attackers with access to a wide range of services, including Microsoft Graph, Key Vault, Azure Storage, and AI Foundry.
Targeting the AI Development Ecosystem
The choice of the agent-framework package highlights an increasing trend of attackers targeting the AI and machine learning development lifecycle. The package, which facilitates the creation of AI agents, has nearly 200,000 monthly downloads.
Analysis from Endor Labs indicated that the attackers likely hijacked the process used to build the package’s “wheel” files. By uploading only pre-built binary wheels rather than source code, the attackers were able to hide the malicious telemetry module more effectively from developers who might inspect the source.
This is not the first instance of a Microsoft-maintained Python SDK being targeted this year. In May, researchers detected trojanised versions of the durabletask package, though no formal link has been established between the two incidents.
Mitigation and Response
Microsoft has not yet publicly confirmed the specific mechanism used to breach the package’s maintainer account or build pipeline. However, security teams are urged to treat any environment where the malicious versions were installed as fully compromised.
Security researchers at Aikido Security noted that removing the package stops future execution but does not retrieve data already sent to the attacker-controlled server. Impacted organisations should immediately perform the following actions:
- Rotate all secrets reachable from the affected host, including Azure service principal keys, GitHub personal access tokens, and API keys for OpenAI or Hugging Face.
- Check build agents and CI/CD logs for the presence of files such as
agent_framework_meta.pthoraf_runtime_diag.py. - Review Azure sign-in and activity logs for suspicious use of managed identities or federated credentials originating from build infrastructure.
- Pin Python dependencies to verified releases with hash checking to prevent automatic updates to unverified or newly uploaded versions.



