Skip to content
chornous.dev

Type two or more letters. Esc closes.

Index of sheets
Theme

Sheet 03 · Writing

All notes

Microsoft agent-framework 1.26.1 and 1.26.2 on PyPI ran a credential stealer on every Python start

On November 17, 2026, an attacker published two malicious versions of Microsoft's agent-framework package to PyPI. Both install a .pth startup hook that harvests CI and cloud secrets and requests fresh GitHub Actions, Azure DevOps and managed identity tokens. PyPI quarantined both; 1.26.0 is the last clean release.

Pl. 29 · section drawing generated from the slug “microsoft-agent-framework-pypi-compromise”

Someone with publishing rights on Microsoft's agent-framework PyPI project uploaded two malicious releases on November 17, 2026: 1.26.1 and 1.26.2. StepSecurity pulled both quarantined wheels from PyPI's file host and published a full static analysis on November 18. Both versions carry a credential stealer that runs whenever Python starts in the affected environment. You never have to import the framework.

PyPI quarantined both releases. The clean version is 1.26.0, released November 12.

The timeline

  1. Nov 12, 18:24 UTC

    The normal release train publishes 1.26.0 with a wheel and an sdist.
  2. Nov 17

    A maintainer account named vibiret appears on the project.
  3. Nov 17, 20:35 UTC

    1.26.1 goes up as a lone wheel with no sdist and no provenance attestation.
  4. Nov 17, 21:06 UTC

    PyPI quarantines 1.26.1.
  5. Nov 17, 21:08 UTC

    The attacker uploads 1.26.2, 2 minutes 23 seconds after the first quarantine.
  6. Nov 17, 21:16 UTC

    PyPI quarantines 1.26.2.

The second upload shows that quarantining 1.26.1 left the attacker's publishing access in place. StepSecurity says the evidence doesn't establish the access vector or the account used, and it doesn't know whether that access still works. Microsoft hadn't published an advisory when I wrote this.

Both malicious wheels kept the real dependency on agent-framework-core[all]==1.26.0, so the framework behaved as usual after install. StepSecurity found no new uploads on the satellite packages it checked, such as agent-framework-openai and agent-framework-redis.

How a .pth file runs code

agent-framework is a thin meta-package. Version 1.26.2 added two files at the wheel root: a 23-byte af_runtime_diag.pth containing import af_runtime_diag, and a 7,658-byte af_runtime_diag.py. Python's site module executes import lines from any .pth file in site-packages during interpreter startup. After installation, the next pytest, linter, build script or pip call in that environment fires the payload.

The payload forks, calls setsid() to detach, and collects:

  • environment variables whose names contain any of 35 substrings, including TOKEN, SECRET, AZURE, AWS, GITHUB, OPENAI and NPM
  • up to 80 credential files, such as Azure CLI token caches, .npmrc, .netrc, .git-credentials, Docker config.json and .env files, plus GitHub Actions runner temp directories in 1.26.2
  • the environments of the first 300 processes it can read under /proc, which can include the CI runner's own secrets

It then asks for fresh tokens: GitHub Actions OIDC tokens for Azure audiences when the job has id-token: write, Azure DevOps OIDC tokens, and Azure managed identity tokens for twelve resources including Key Vault, Storage and Container Registry. It compresses the bundle and posts it in one request to a webhook.site URL.

Check your environments without starting Python

StepSecurity's first remediation step is blunt: contain the host before you run Python or pip, because pip show would start the interpreter and trigger the hook again. Use plain shell tools:

# Look for the payload files in every site-packages under a path
find / -path '*/site-packages/*' \( \
  -name 'af_runtime_diag.pth' -o -name 'af_runtime_diag.py' -o \
  -name 'agent_framework_meta.pth' -o -path '*/agent_framework_meta/_telemetry.py' \
\) 2>/dev/null

# Find the bad versions in lockfiles and requirements
grep -rnE 'agent-framework[^-].{0,6}1\.26\.[12]' --include='*.txt' --include='*.lock' --include='*.toml' .

In egress and proxy logs, search for POST requests to webhook.site with the user agent runtime-diagnostics/1 or af-runtime-diagnostics/1. StepSecurity warns that a connection to the domain alone doesn't prove a transfer.

Rotate secrets, then chase the tokens

The payload mints tokens, so rotating static secrets doesn't revoke what it already received. StepSecurity says a stolen OIDC token stays usable while valid if the cloud provider accepts its claims, and removing a federated trust blocks future exchanges without revoking tokens already issued.

If either version ran anywhere, StepSecurity's remediation goes like this:

  1. Isolate the host, container or runner before starting Python.
  2. Kill the detached collector, then rebuild the environment from a clean base. Deleting the hook doesn't stop a running collector.
  3. From a clean machine, rotate CI secrets, cloud keys, registry and Docker credentials, Git credentials, Hugging Face tokens and Azure CLI caches.
  4. Audit GitHub OIDC permissions, Azure federated credentials, Azure DevOps service connections and managed identity role assignments. Look for token issuance and resource access you can't explain.
  5. Pin agent-framework==1.26.0 in a hash-pinned lockfile, block 1.26.1 and 1.26.2, and purge cached wheels and images that contain them.

This week

Search every lockfile, CI log, internal mirror and image built since November 17 for agent-framework 1.26.1 or 1.26.2. Restrict id-token: write to the jobs that need it. If you don't run a package cooldown yet, add one: both releases spent under 35 minutes on PyPI, and a two-day wait would have skipped them.

Volodymyr Chornous