News Application Security
Trojanised agent-framework Releases on PyPI Ran a Credential Stealer at Every Python Startup
Two releases of Microsoft's agent-framework package on PyPI carried a credential stealer delivered through a .pth startup hook, so it ran whenever Python started, without the package being imported. Both have been removed, and how they were uploaded is not confirmed.

Key takeaways
- Two agent-framework releases on PyPI contained a credential stealer and have been removed.
- The trigger was a .pth startup hook, so installing the package was enough, importing it was not required.
- Targets include CI and cloud secrets, credential files, Azure managed-identity tokens and OIDC tokens.
- The root cause is unconfirmed, and vendor theories about it are hedged by the vendors themselves.
- Anyone who installed either release should rotate every credential reachable from that environment.
Two malicious releases of Microsoft's agent-framework package were published to PyPI this week. The GitHub Advisory Database tracks them as malware under GHSA-764m-3ppc-5m73, classified as CWE-506, with no CVE and no patched version. The advisory says the release immediately before them and everything earlier are not affected, and that both malicious releases have been removed from PyPI.
How it ran #
The payload did not live in the package's import path. Each release added a .pth file to site-packages. In the advisory's words: "Python runs .pth files at every interpreter start, so the code executes as soon as the package is installed, without importing agent_framework."
The first release added agent_framework_meta.pth and a telemetry-named module. The second added af_runtime_diag.pth and af_runtime_diag.py. The advisory notes the rest of the wheel matches the last clean release.
That means a transitive install in a CI job was enough. No code in your project had to touch the package.
What it took #
Per the advisory, the stealer collects:
- Environment variables whose names contain strings such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, OPENAI, NPM, PIP or CI_
- Other processes' environments through /proc
- Credential files, including ~/.azure, .npmrc, .netrc, .git-credentials, .docker/config.json and .env files
- Azure DevOps OIDC tokens and Azure managed-identity tokens from the instance metadata service
The second release also targets GitHub Actions OIDC and runtime tokens. Data is compressed, encoded and sent by HTTP POST to a webhook.site URL that is identical in both releases.
What is not known #
The advisory says: "We have not attributed this to a known campaign." StepSecurity states that the available evidence does not establish the initial access vector, the account or credential used, or the uploader's identity. Wiz says the attacker appears to have compromised a client certificate and private key for a Microsoft release-signing service, and adds that how the credentials were obtained is not yet known. Treat that as a vendor assessment, not a confirmed root cause.
By StepSecurity's timeline, the second release was uploaded about two minutes after the first was quarantined.
What to do #
- Search lockfiles, container images and CI logs for the two versions named in the advisory.
- Look for the .pth files above in site-packages.
- Pin to the last clean release.
- If either version was installed, follow the advisory: "treat the environment as exposed and rotate the credentials reachable from it, including CI and GitHub Actions secrets." Rotate from a clean system.
- Longer term, this is a case for pinned dependencies, an install cooldown on fresh releases, provenance checks and narrow id-token permissions in CI.
Sources
Questions this raises
- Do I have to import agent_framework for the malware to run?
- No. The payload is loaded from a .pth file, which Python processes at every interpreter start in that environment. Installation alone is enough.
- How do I check whether I was affected?
- Check lockfiles, images and CI logs for the two versions listed in GHSA-764m-3ppc-5m73, and look in site-packages for agent_framework_meta.pth or af_runtime_diag.pth.
- How did the attacker publish the releases?
- That is not confirmed. StepSecurity says the evidence does not establish the access vector or the uploader's identity. Wiz offers a hedged assessment involving a compromised signing credential.
- Is removing the package enough?
- No. The advisory says to treat the environment as exposed and rotate the credentials reachable from it, including CI and GitHub Actions secrets.