Your Python Interpreter Was the Attack Surface: What the agent-framework PyPI Poisoning Means for Your Next pip install

On November 17, 2026, two poisoned versions of Microsoft's agent-framework package hit PyPI — 1.26.1 at 20:35 UTC and 1.26.2 at 21:08 UTC. Both were quarantined within the hour. The last clean version is 1.26.0.

Here's the part that should change how you think about pip install: the malware never needed your code to import the package. It ran every time Python started.

A one-line .pth file did all the work

Python executes .pth files in site-packages at interpreter startup, before your code runs and regardless of what it imports. Each malicious wheel dropped a one-line .pth file — import agent_framework_meta in 1.26.1, import af_runtime_diag in 1.26.2 — that launched a credential stealer. It fired on python, pytest, IDE language servers, container entrypoints, even pip itself. The collector wrote no lockfiles or markers, so every launch exfiltrated again.

The second release was sneakier than the first: 1.26.1 appended a telemetry call to __init__.py, which a diff would catch; 1.26.2 restored that file byte-for-byte and moved the payload into a separate module. Diffing the package code between 1.26.0 and 1.26.2 finds nothing wrong.

The attacker's tooling called itself "Cairn", an open-source AI pen-testing framework. Wiz reported the attacker appears to have compromised a client certificate and private key for Microsoft's ESRP release pipeline. JFrog's forensics add a twist: ZIP headers show the wheel was repacked locally at 20:26 UTC, nine minutes before upload, on a host with a UTC+8 clock. The publishing credential was real; the build was not.

What it took

  • Environment variables matching 31 keywords (TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, OPENAI, HF_…) from the current process and up to 300 other processes via /proc/*/environ.
  • Credential files — up to 60 in 1.26.1, 80 in 1.26.2: Azure CLI state, .npmrc, pip.conf, .netrc, .git-credentials, Docker config, Hugging Face tokens, .env files.
  • Fresh tokens, not just stored secrets: Azure managed-identity tokens for 12 resources, Azure DevOps OIDC tokens, and in 1.26.2, GitHub Actions OIDC tokens when workflows had id-token: write.
  • Everything went out as one zlib-compressed, base64-encoded JSON POST to a webhook.site URL.

OIDC and managed-identity tokens are minted live — you can't find them by scanning old files, and they carry the exact cloud permissions your CI pipeline holds.

The exposure math (my calculation)

The package gets ~190,000 downloads a month (Orca), ~41,000 a week (Wiz) — roughly 6,300 a day, 264 an hour. Spread evenly across the 41-minute window, that implies ~180 installs of the poisoned versions. An estimate, not a reported count — but it frames the scale: not thousands of machines, a short, sharp exposure of developers who install first and ask questions later.

Per host it gets worse. A CI runner invoking Python 100 times a day sent roughly 100 exfiltration posts a day until the environment was rebuilt. And the cleanup bill: a small team (five devs, three CI runners) faces eight environments at 10–20 secrets each — 80 to 160 credentials to rotate, two to four hours per environment, 16 to 32 engineer-hours total. That is the real cost of a 41-minute window.

Check your environment now

  1. pip show agent-framework — 1.26.1 or 1.26.2 means exposed. Pin to 1.26.0.
  2. Assume compromise. Rotate every credential the environment could see and review cloud audit logs from November 17 onward.
  3. Delete the hooks — agent_framework_meta.pth / af_runtime_diag.pth and their modules — uninstalling alone may not remove them.
  4. Pin and hash everything. Lockfiles with hashes (pip-compile --generate-hashes, Poetry, uv lock) are the only thing that catches a repacked wheel. A version pin alone would not have saved anyone here — 1.26.1 looked like a legitimate bump.
  5. Scan site-packages for .pth files in CI. There should be almost none, and every one should be explicable.

The agent era concentrates risk: the frameworks every AI builder installs first run on machines holding cloud keys and production credentials. Treat pip install with the same suspicion you give a stranger's shell script — as November 17 proved, that is exactly what it can be.

Sources: Wiz, JFrog, Orca Security (Nov 2026); exposure estimates are my own calculations. By Shivam Kumar, VisionQuantech.