Skip to content

Microsoft

Microsoft Agent Framework PyPI Hack: Check 1.26.1 and 1.26.2

Microsoft's agent-framework 1.26.1 and 1.26.2 on PyPI ran a credential stealer at every Python start. We checked in a clean venv: PyPI now stops at 1.26.0, the clean wheel matches its hash, and 0 hook files on 121 folders.

By Duy Lam Le, written with AI8 min read

Why trust this: every result, number and screenshot comes from a real run on our own accounts, not from the AI. How we test

Đọc bản tiếng Việt →

Screenshot: terminal shows PyPI's newest agent-framework is 1.26.0, pip refuses 1.26.1 and 1.26.2, and our check script reports 0 hook files
Screenshot from the test run.

Checked 19 Nov 2026. Two releases of Microsoft's official agent-framework package on PyPI, 1.26.1 and 1.26.2, were published on 17 Nov 2026 with a credential stealer inside. It ran at every Python start, even without an import. PyPI has removed both. The newest release it still serves is 1.26.0, and that is the version to pin.

Who is affected: any machine, container or CI runner where pip, uv or another installer pulled agent-framework 1.26.1 or 1.26.2. Who is not: environments that only ever had 1.26.0 or older, and machines that never installed the package. We ran the checks below in a clean virtual environment on our own PC and scanned all 121 Python package folders on it. We never downloaded the bad releases: PyPI no longer has them, and we only asked pip for them in --dry-run mode.

At a glance

Key results

  • PyPI serves nothing newer than 1.26.0. pip index versions agent-framework lists 1.26.0 as the newest, and asking for 1.26.1 or 1.26.2 ends in "No matching distribution found". PyPI's JSON API returns 404 for both versions.
  • The clean 1.26.0 wheel matches PyPI. We downloaded it and its SHA256 (14267ec8…b6d71) matched the digest PyPI publishes for that file.
  • The clean install ships zero .pth files. After installing 1.26.0 (209 packages in the venv, pip included, in 143 seconds), our check script found no .pth file at all. Any agent_framework_meta.pth or af_runtime_diag.pth you find is a red flag.
  • A loose search gives a false alarm. The clean 1.26.0 install has a folder named agent_framework_meta, so grepping for that name flags a safe machine. Search for the .pth file names instead.
  • Our machine: 121 site-packages folders scanned, 0 installs of agent-framework, 0 hook files, in under 10 seconds.

Hands-on test

Setup

  • Date and machine: 19 Nov 2026, a PC running Linux (WSL), Python 3.13.16, pip 26.2.1.
  • Clean environment: a new python -m venv with nothing installed, created only for this test.
  • What we installed: only agent-framework==1.26.0, the release BleepingComputer calls safe. We did not install, download or unpack 1.26.1 or 1.26.2.
  • Scripts: af_check.py (below), a folder scan for the hook files, and plain ls/find/grep commands. All terminal output in this article is copied from our run.

Microsoft Agent Framework PyPI versions that were compromised

VersionStatus on PyPI (19 Nov)Startup hook fileWhat it ran
1.26.0Newest available release, uploaded 12 Nov 2026 (UTC)noneClean
1.26.1Removed (404)agent_framework_meta.pthagent_framework_meta/_telemetry.py
1.26.2Removed (404)af_runtime_diag.pthaf_runtime_diag.py

According to Socket's analysis, both bad versions sent what they collected, compressed and Base64-encoded, to the same webhook.site address. BleepingComputer adds that PyPI quarantined the first bad release, the attacker published the second about 2.5 minutes later, and PyPI quarantined that one about 8 minutes after it went up. Both bad releases kept their dependency on the real agent-framework-core 1.26.0, so the framework worked as normal while the stealer ran.

Not confirmed yet: how the attacker got publishing rights on Microsoft's PyPI project, and how long the first release was online. BleepingComputer said Microsoft had not replied by the time it published.

Why the stealer ran without an import

Python reads every .pth file in site-packages when it starts. The Python documentation on the site module says that lines starting with import "are executed with exec()". The bad releases each added a one-line .pth file that imported the stealer, so it started with any Python process in that environment: your app, your tests, and pip itself.

That last point matters for clean-up. In an infected environment, every pip list or pip uninstall starts Python and fires the hook again. This is why BleepingComputer's advice is to stop running Python or pip there until the environment is isolated. Python 3.15 marks these import lines as deprecated but still runs them, so a newer Python is not a fix.

What the Microsoft Agent Framework exposure covers

Socket lists what the code collected. In short:

  • Environment variables whose names contain words such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI and HF_. This is a substring match, so OPENAI_API_KEY, AWS_SECRET_ACCESS_KEY and HF_TOKEN all qualify.
  • Other processes' environments through /proc/*/environ on Linux, where permissions allowed.
  • Credential files: Azure CLI files in ~/.azure, .git-credentials, .netrc, .npmrc, pip.conf, Docker's config.json, the Hugging Face token file, and .env files under /app and /workspace.
  • Fresh cloud tokens: Azure managed-identity tokens in both versions, and GitHub Actions OIDC tokens in 1.26.2.

If a key was readable by Python on that machine, treat it as exposed.

How to check the installed Python package version with pip

Run this with the Python of the environment you want to check. Do it only on a machine you believe is clean; on a suspect machine use the file check in the next section, which does not start Python.

$ pip show agent-framework
Name: agent-framework
Version: 1.26.0
...
Requires: agent-framework-core

$ pip index versions agent-framework
agent-framework (1.26.0)

If you manage the environment with uv, uv pip list --python .venv/bin/python prints the same package table without needing pip inside the venv. To check what you asked for rather than what is installed, search your requirement and lock files:

$ grep -rn 'agent-framework' requirements.txt
1:agent-framework==1.26.0

The same grep works on uv.lock and poetry.lock. Look for 1.26.1 or 1.26.2, and for an unpinned agent-framework line in any CI job that ran on 17 Nov.

Terminal: pip index lists 1.26.0, pip refuses 1.26.1 and 1.26.2, pip show reports 1.26.0, our check script reports clean
Our run on 19 Nov 2026: PyPI offers nothing newer than 1.26.0, the --dry-run requests for 1.26.1 and 1.26.2 fail, and the clean install has 0 hook files.

Check for the hook files without starting Python

These are plain shell commands. They read the folder listing and never run Python, so they are safe on a machine that may be infected.

$ ls .venv/lib/python3.*/site-packages | grep -E '^(agent_framework_meta|af_runtime_diag)\.pth$|^af_runtime_diag\.py$'
(no output)

$ find ~ /usr /opt \( -name 'agent_framework_meta.pth' -o -name 'af_runtime_diag.pth' -o -name 'af_runtime_diag.py' \) 2>/dev/null | wc -l
0

No output and a count of 0 is what you want. Be precise with the pattern. Our first, looser grep for agent_framework_meta matched the folder that the clean 1.26.0 release installs, and that is not a sign of infection.

For many environments at once, a shortened version of our af_check.py does the same from inside Python (run it only on a clean machine):

import importlib.metadata as md
import site
from pathlib import Path

BAD_VERSIONS = {"1.26.1", "1.26.2"}
BAD_FILES = ("agent_framework_meta.pth", "af_runtime_diag.pth", "af_runtime_diag.py")
dirs = [Path(p) for p in {*site.getsitepackages(), site.getusersitepackages()} if Path(p).is_dir()]
try:
    version = md.version("agent-framework")
except md.PackageNotFoundError:
    version = None
hits = [d / name for d in dirs for name in BAD_FILES if (d / name).exists()]
print("agent-framework:", version or "not installed", "| hook files:", len(hits))
print("COMPROMISED" if version in BAD_VERSIONS or hits else "clean")
Terminal: 121 site-packages folders scanned with 0 hook files, SHA256 of the 1.26.0 wheel, and pip uninstall
Our PC on 19 Nov 2026: 0 copies of agent-framework and 0 hook files in 121 package folders. The 1.26.0 wheel hash matches PyPI.

If you find 1.26.1 or 1.26.2: remove it and rotate keys

  1. Isolate the machine or runner. Cut its network access if you can, and stop running Python or pip in that environment.
  2. Rotate first, clean second. From a different, clean machine, revoke and replace every key that environment could read: Azure service principals and storage keys, AWS access keys, GitHub tokens, OpenAI and other AI API keys, Hugging Face tokens, Docker and npm credentials. Creating a new key is not enough; the old one has to be revoked.
  3. Rebuild, do not patch. Delete the virtual environment or container image and create it again from scratch with agent-framework==1.26.0 pinned. If the bad version was installed into a system Python, rebuild the machine or restore it from a known-good image.
  4. Check your logs. BleepingComputer suggests looking for the webhook path in outbound (egress) logs, and telling blocked requests apart from requests that went through.
  5. Pin and lock. Use exact versions in requirements.txt or a lock file with hashes, so a new release cannot slip into CI unannounced.

If you need to create a fresh AI key after revoking one, our guides to the Google AI Studio API key and the ElevenLabs API key walk through the screens.

What worked

What worked

  • --dry-run let us confirm that PyPI no longer serves 1.26.1 and 1.26.2 without downloading anything.
  • Matching on exact file names (agent_framework_meta.pth, af_runtime_diag.pth, af_runtime_diag.py). These names come from Socket's write-up and do not exist in the clean release.
  • Comparing the wheel hash with the one PyPI publishes. It takes one command and proves which file you actually have.

Where it fell short

What didn't work

  • A loose grep agent_framework_meta. It matched the legitimate folder in 1.26.0 and would have raised a false alarm.
  • pip list | grep agent as a quick look. The full 1.26.0 install pulls in 63 folders whose names start with agent_framework, so the one line you care about is easy to miss. Use pip show agent-framework.
  • Testing the stealer itself. We chose not to: running live malware to take a screenshot is not worth the risk, and the file names and versions are enough to check a machine.

Our verdict

If you use Microsoft Agent Framework in Python, pin agent-framework==1.26.0 today and run the shell check above on every machine and CI runner that installed packages on 17 Nov 2026. If you find either bad version, treat every key on that machine as stolen and rotate it before you clean up. The attack is over on PyPI, but the keys it took stay valid until you revoke them.

FAQ

Is Microsoft Agent Framework safe to install now?

Version 1.26.0 is the newest release PyPI serves, and the wheel we downloaded matched PyPI's published SHA256. Pin that exact version until Microsoft publishes a newer release and explains how the project was compromised.

Does it matter if I never imported agent_framework?

No. The bad versions ran from a .pth file that Python loads at startup, so installing the package was enough.

Is agent-framework-core affected?

The reports name only the agent-framework package, versions 1.26.1 and 1.26.2. Both of those depended on the real agent-framework-core 1.26.0.

How do I check the installed package version without pip?

List the site-packages folder: the installed version is in the folder name, for example agent_framework-1.26.0.dist-info. This does not start Python.

How this page was made: an AI assistant (Claude) helped write the text and the check scripts. The version list, the dry-run errors, the SHA256 match and the 121-folder scan come from our own run on 19 Nov 2026; the details of the malware come from Socket's and BleepingComputer's reports, linked below. The RanThis editor checked each fact against those pages and PyPI before publishing.

Higgsfield

Higgsfield API: Why Your Plan Credits Return 403

We called the Higgsfield API with a valid key from an account holding 158.06 plan credits and got 403 not_enough_credits. Bearer, a wrong secret and no header all returned 401. Plus the 96-model list and an SDK example that 404s.

ElevenLabs

ElevenLabs Free Plan: 10,000 Credits Is 10 or 21 Minutes

We spent ElevenLabs free credits through the API: 10,000 credits a month buys about 10 minutes of speech on Eleven v4 and 18 to 21 on Flash or v4 Turbo. The free tier API key runs every model but refuses cloning, 192 kbps and commercial use.

Latest guides

All guides

Claude

Claude API Cost: 40 Invoices, 3 Models, a 33x Price Gap

One real job on Claude Haiku 5.5, Sonnet 5.5 and Opus 5.5: 40 invoices, 7 fields each. All scored 40 of 40, and the bill ran from $0.0158 to $0.5238 per 100 invoices. Thinking tokens were over half the output.