News Application Security
Malicious agent-framework Releases on PyPI Stole Cloud and CI Credentials
Two malicious releases of Microsoft's agent-framework Python package were published to PyPI and pulled within the hour, according to Elastic Security Labs and Wiz. Both carried a credential stealer that ran on every Python start, whether or not the package was imported.

Key takeaways
- Two malicious agent-framework releases were live on PyPI for under an hour, per Elastic Security Labs and Wiz.
- A .pth file launched the stealer on every Python start, so importing the package was not needed.
- Targets included environment secrets, credential files, Azure tokens and GitHub Actions OIDC tokens.
- Wiz's analysis points to a compromised Microsoft ESRP publishing credential, with the theft method unknown.
- Pin to the last clean release, hunt for the two .pth files and rotate exposed secrets.
Two malicious releases of agent-framework, Microsoft's AI agent package for Python, were published to PyPI this week, about half an hour apart. Elastic Security Labs and Wiz both analysed them and report that PyPI removed the releases within the hour. The PyPI release history no longer lists either one, and the release before them is the last clean one.
Installed was enough #
Both releases shipped a .pth file. Python processes .pth files in site-packages at interpreter startup, so the payload ran on every Python start in the environment. Elastic stresses that importing the package was not required.
The first release added agent_framework_meta.pth and a _telemetry.py module under agent_framework_meta. The second used af_runtime_diag.pth and af_runtime_diag.py, and added theft of GitHub Actions OIDC tokens.
What the stealer took #
According to the two vendor analyses, the stealer collected:
- Secret-like environment variables, including those of other processes read through
/proc/<pid>/environ - Credential files for pip, npm, netrc, git, Docker and Hugging Face, plus .env files and Azure Pipelines agent credentials
- Azure CLI token caches and Azure DevOps OIDC tokens
- Azure managed identity tokens for 12 resources, and Azure instance metadata
The data was serialized to JSON, compressed, Base64-encoded and sent in a single POST to a webhook.site endpoint. The User-Agent was af-runtime-diagnostics/1 in the first release and runtime-diagnostics/1 in the second.
What Wiz says about the cause #
The following is Wiz's analysis, not a confirmed root cause. Wiz says the attacker appears to have compromised a client certificate and private key for Microsoft's ESRP publishing service. A first publish attempt from AWS was rejected by ESRP IP filtering, and a second from Microsoft-owned IP space succeeded. How the credentials were obtained is not known. Wiz also says the attacker's tooling identified itself as Cairn, which Wiz describes as an open-source AI penetration-testing framework.
Of 50 exfiltration requests Wiz captured and analysed, it attributes four to the attacker's own machines and 29 to sandboxes, vendor scanning or tests. The remaining 17 represent three unique successful exfiltrations of victim data, by Wiz's count.
Elastic says its supply-chain monitor flagged the first release as malicious six minutes after publication. That is a vendor claim.
What to do #
The two vendors' guidance shares these core steps:
- Pin agent-framework to the last clean release.
- Search site-packages for
agent_framework_meta.pthandaf_runtime_diag.pth. - Search proxy and DNS logs for webhook.site and the two User-Agent strings.
- Rotate every secret readable on an affected host.
Wiz notes that stolen Azure tokens stay valid for up to 24 hours, so rotation alone does not close the window on those. Any pipeline or developer machine that resolved an unpinned agent-framework during the exposure window should be handled as a credential compromise, including Azure managed identities and GitHub Actions OIDC trust.
Sources
Questions this raises
- Am I affected if I never imported agent-framework in my code?
- You can be. Elastic reports the payload was launched from a .pth file, which Python processes at every interpreter start. Having a malicious release installed in the environment was enough.
- How do I check a host or build image?
- Search site-packages for agent_framework_meta.pth and af_runtime_diag.pth, and search proxy and DNS logs for webhook.site and the User-Agent strings af-runtime-diagnostics/1 and runtime-diagnostics/1.
- How did the attacker publish under Microsoft's package?
- Wiz's analysis is that a client certificate and private key for Microsoft's ESRP publishing service appear to have been compromised. Wiz says it is not yet known how those credentials were obtained.