Microsoft's agent-framework on PyPI was hijacked for under an hour. That was enough.

Two releases of Microsoft's official agent-framework package on PyPI went out with a credential stealer inside. Version 1.26.1 was published at 20:35 UTC on 17 November, and 1.26.2 followed at 21:08 UTC. Both were quarantined by about 21:30 UTC, so the window was less than an hour. For a package with roughly 190,000 downloads a month, an hour is plenty.
The delivery method is the part that should make Python teams uncomfortable. Each wheel drops a .pth file into site-packages: agent_framework_meta.pth in 1.26.1, af_runtime_diag.pth in 1.26.2. Python executes import lines in .pth files every time the interpreter starts. You don't need to import agent_framework. You don't need to use it at all. If it's installed in an environment, every Python process in that environment runs the stealer. Your test runner, your linter, a throwaway script someone runs at 2am.
What the stealer takes
It sweeps environment variables whose names look like secrets (TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, OPENAI and similar). It reads credential files such as ~/.azure, .npmrc, .netrc, .git-credentials and Docker config. It also reads other processes' environments from /proc/*/environ, which is how you get secrets from a process you never touched.
Then it goes past files. It asks the Azure IMDS and App Service identity endpoints for managed-identity tokens. Inside Azure DevOps it uses SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI to request an OIDC token. Version 1.26.2 added GitHub Actions OIDC tokens to the shopping list. Everything gets packed as JSON, compressed with zlib, base64-encoded and POSTed over HTTPS to a hardcoded webhook.site URL.
How the attacker got publishing rights isn't confirmed yet. What we do know: 1.26.1 was uploaded as a wheel only, and there is no python-1.26.1 tag or release in the microsoft/agent-framework repository. A release on the registry with no matching release in the source repo. Keep that in mind, because you can check for it automatically.
Why this is worse than the usual infostealer
We covered the WPPConnect npm infostealer two days ago, and I'll admit my first reaction was "another one." But this one is different in two ways that matter.
The first is trust. This isn't a typosquat with a misspelled name. It's Microsoft's own package. Any policy that says "well-known publisher, let it through" waved this straight in.
The second is identity. Stealing a .npmrc is bad. Minting a fresh managed-identity token from the machine's own identity endpoint, or an OIDC token from your CI system, is a different class of problem. Those tokens can be exchanged for real Azure access, and rotating your stored secrets does nothing about them. Wiz advises auditing Azure identities and federated credentials, and says stolen tokens may be valid for up to 24 hours. If a runner of yours installed 1.26.1 or 1.26.2 last night, those tokens could still work right now.
During our pentesting engagements, the jump from "we got a foothold" to "we own the environment" almost never comes from a password file. It comes from an identity with far more permissions than its job needs. A managed identity on a build agent with Contributor on the whole subscription, because scoping it properly was a ticket nobody got to. We find that one constantly, and it's exactly the kind of thing this payload was built to cash in.
What to do this morning
- Pin
agent-framework==1.26.0. It's the last clean release. The GitHub advisory says 1.26.0 and earlier are unaffected and that there is no patched version of the bad ones. Drop any open range like>=1.26. - Search lockfiles, CI logs and virtualenvs for 1.26.1 or 1.26.2. Include container images and dependency caches built last night, not just your laptops.
- Look for the startup hooks directly:
find / \( -name agent_framework_meta.pth -o -name af_runtime_diag.pth \) 2>/dev/null - Rotate every secret reachable from any affected host or runner. All of them, including the ones that look boring.
- Audit your Azure identities and federated credentials, and go through the activity of any managed identity or service principal an affected machine could reach. If 1.26.2 ran in GitHub Actions, review what your OIDC trust lets those workflows assume.
The longer-term fixes
From our PHP and Docker work, the habit that saves us most often is boring: images are built from lockfiles with hashes, and nothing new gets in unless a human updates the lock. In Python that means hash-pinned requirements or a proper lock file, installed in a mode that refuses anything unhashed. A compromised new version can't sneak in on a routine rebuild.
Add a cooldown too. Most modern Python tooling and dependency bots can be set to ignore releases younger than a few days. Both bad versions here were gone within an hour, so even a 72-hour delay would have skipped them completely. You lose a little freshness. I think that trade is obviously worth it for anything that runs in CI.
Lock down egress from build runners. A runner that needs PyPI, your registry and your cloud APIs has no business posting to a random webhook service. When we set up network controls for clients, outbound allowlists on build networks are usually the cheapest control with the biggest payoff, and they would have stopped this exfiltration cold.
And scope your identities. OIDC federation is still much better than long-lived secrets in CI, so don't read this as a reason to go back. But a federated credential should be bound to a specific repo, branch or environment and carry the smallest role that works. The token this stealer mints is only as dangerous as the permissions behind it.
One more thing for mobile teams. In our native iOS and Android projects, the CI runners hold the really sensitive material: signing keys, store credentials, API keys for backend environments. Those same pipelines often call small Python helper scripts for version bumps, localization or uploads. Since a .pth hook fires on any Python start, it's worth asking whether your mobile build images share a Python environment with anything that pulls fresh packages. We've seen that pattern in healthcare and IoT apps more than once, usually because someone reused a general-purpose runner image to save time.
Agent frameworks are where a lot of teams are experimenting right now, and experiments tend to run with generous credentials and loose pinning. That's the part I keep thinking about. The people most likely to have installed this package are also the ones most likely to have an OpenAI key and broad Azure access sitting in the same shell.
If you want a second pair of eyes on your CI identities and build pipeline, that's the kind of cloud security review we do regularly. You can see how we work on our services page and in our portfolio.
If you're not sure which cloud identities your build runners can reach, or how far a stolen token would get, let's talk.