Microsoft agent-framework on PyPI: Two Rogue Releases Run a Credential Stealer at Every Python Start
On November 17, 2026, two malicious releases of agent-framework, the PyPI meta-package that installs Microsoft Agent Framework (Microsoft's open-source Python SDK for building AI agents), were published 33 minutes apart: 1.26.1 at 20:35 UTC and 1.26.2 at 21:08 UTC. Each added a .pth startup hook, so a credential stealer ran whenever Python started in that environment, with no import of the framework. It collected secrets from environment variables, other processes and credential files, requested fresh Azure and CI identity tokens, and sent everything to a webhook.site URL. PyPI quarantined both versions, yet the second appeared 2 minutes 23 seconds after the first was quarantined. Wiz found only three unique cases of victim data among the 50 requests the URL stored. How the attacker obtained publishing access is not confirmed.
Threat Analysis
- What happened. agent-framework is the package that Microsoft's quick-install instructions recommend for Microsoft Agent Framework, its open-source Python SDK for building AI agents. The package holds almost no code of its own and pulls in agent-framework-core. On November 17, 2026, two releases appeared on the official PyPI project: 1.26.1 at 20:35:20 UTC and 1.26.2 at 21:08:39 UTC. JFrog's reading of the archive metadata shows that Microsoft's pipeline did not build them: each was a repacked copy of the clean 1.26.0 wheel with a credential stealer added. The dependency on agent-framework-core 1.26.0 was left alone, so the framework installed and ran as usual.
- Why no import was needed. Each wheel placed a .pth file in site-packages, the directory where Python keeps installed packages. Python reads .pth files at every interpreter start and executes any line that begins with import. Installing the wheel runs nothing, but the next python, pytest or pip command in that environment starts the stealer. It detaches into the background and suppresses its errors, and it leaves no marker on disk, so each separate Python launch collects again.
- What it took and what it asked for. The collector gathered environment variables whose names suggest secrets, the environments of up to 300 other processes on Linux, and up to 60 credential files (80 in 1.26.2): Azure CLI token caches, package-registry and Git credentials, Docker configuration, Hugging Face tokens and Azure DevOps agent credentials. It then requested new tokens: Azure managed-identity tokens for 12 resources, an Azure DevOps OIDC token and, in 1.26.2, GitHub Actions OIDC tokens. Everything left in one HTTPS POST to a fixed webhook.site URL, with no retry and no second channel.
- The second release came 2 minutes 23 seconds after the first quarantine. According to the release records StepSecurity read from PyPI, 1.26.1 was quarantined at 21:06:16 UTC and 1.26.2 was live at 21:08:39 UTC. The stealer had moved to new file names and the modified __init__.py was back to its clean content, so a check keyed on the first version's files or diff would pass the second. PyPI quarantined 1.26.2 at 21:16:44 UTC. Taking a release down did not take publishing access away from the attacker.
- What the evidence shows and what it does not. Wiz read the attacker's webhook URL and found 50 stored requests: four from the attacker's own machines, 29 from sandboxes and scanners, and 17 that represent three unique cases of victim data. Static analysis shows that tokens were requested, not that they were issued, and no public source so far reports later use of stolen credentials. On the publishing path, Wiz assesses that the attacker appears to have used a compromised client certificate and private key for ESRP, Microsoft's internal signing and publishing service; SafeDep notes a maintainer account that joined PyPI the same day, whose role is unknown. SecurityWeek reports that a project maintainer confirmed the removal and an investigation; as of November 24, Microsoft had not published a root cause. PyPI's record for the clean 1.26.0 shows the same uploader client string that StepSecurity recorded for the malicious wheels, and no provenance, so upload metadata could not tell the releases apart.
Applicable AIDEFEND Defenses (10)
What Defenders Should Do Now
- Find out whether either version reached you, without starting Python. Search lock files, CI logs, internal mirrors and container images for agent-framework 1.26.1 or 1.26.2 and for the wheel SHA-256 digests d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110 (1.26.1) and 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9 (1.26.2). On hosts and images, look in site-packages for agent_framework_meta.pth, agent_framework_meta/_telemetry.py, af_runtime_diag.pth and af_runtime_diag.py with file tools, not with pip or a Python command. If any is present, isolate the environment from the network and rebuild it from a clean base pinned to 1.26.0.
- Check whether data left. Search proxy and DNS logs for webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb and for the User-Agent values af-runtime-diagnostics/1 and runtime-diagnostics/1. Wiz reads an HTTP 200 as data accepted and a 410 or 429 as likely rejected; a connection to the domain alone proves neither.
- Respond by credential type. Revoke and replace every long-lived secret the environment could read, and confirm at the issuer that the old value is refused. Revoke Entra ID sessions for accounts whose Azure CLI caches were on the machine. Managed identities and OIDC-federated pipelines have nothing to rotate: review their sign-in and activity logs from the install time onward, disable or tighten the federated credentials and service connections the affected jobs could use, and re-register self-hosted runners whose credential files were readable.
- Close the install path. Lock the whole dependency tree with hashes and install only from that lock; in a test pipeline, an unpinned pip install agent-framework should fail or resolve only to the locked hash. Make a package-behavior check a required status on dependency-update pull requests, and confirm that a bump with no verdict cannot merge automatically.
- Test outbound connections where Python actually runs. From a real CI runner or sandbox, send a request to a host that is not on the allowlist and confirm that it is blocked and logged. Where the job does not need the host's managed identity, confirm that 169.254.169.254 is unreachable from it.
- If you publish packages yourself. Review who and what can upload to your registry project. Remove long-lived upload credentials and any account you cannot account for, and move publishing to a protected CI workflow with trusted publishing. When a release appears that you did not publish, revoke the credential that published it together with taking the release down.
2 additional considerations
Wait before adopting brand-new releases
Keep identity-token permission out of jobs that install and test dependencies
Conclusion
Last updated: