Answers · Supply chain

agent-framework 1.26.1 / 1.26.2 on PyPI: did the .pth stealer run on your machine or CI, and what to rotate

If agent-framework 1.26.1 or 1.26.2 was installed anywhere, assume every secret readable on that host or runner is gone, and pin back to 1.26.0. Both releases, published to the real package on PyPI on Nov 17, add a .pth startup hook, so the stealer ran every time Python started in that environment, for any script, whether or not anything imported the package.

PyPI removed both within the hour, per Elastic, but lockfiles, dependency caches, virtualenvs and Docker images made in that window still carry them. Find them without starting Python, rebuild from 1.26.0, rotate what the host could read (cloud, CI, GitHub, registry, Docker, Hugging Face and AI keys), prove each old value fails, and search egress logs for the exfil URL.

What was published (Nov 17)

  • Two malicious releases of the real package. GitHub's advisory (GHSA-764m-3ppc-5m73): 1.26.1 at 20:35 UTC (wheel only) and 1.26.2 at 21:08 UTC, both since removed from PyPI; "1.26.0 and earlier are not affected." It's the Agent Framework meta-package, about 196,000 downloads a month per Elastic. The rest of each wheel matches 1.26.0 and still depends on agent-framework-core[all]==1.26.0, so the framework kept working.
  • How it ran. 1.26.1 adds agent_framework_meta.pth containing import agent_framework_meta, which starts agent_framework_meta/_telemetry.py. 1.26.2 renames them to af_runtime_diag.pth and af_runtime_diag.py. Python's site module executes .pth lines that start with import at every interpreter start. The helper forks into a detached background process (a thread on Windows), so nothing looks slow.
  • Caught fast. Elastic flagged 1.26.1 at 20:41 UTC, six minutes after it went live. BleepingComputer reports 1.26.2 appeared about 2.5 minutes after PyPI quarantined the first, so the attacker still had publishing access.
  • How they got publish access: not established. BleepingComputer: "It remains unclear how the attacker gained access to publish malicious releases." Microsoft told The Register: "We have made some repositories private while we investigate malicious content." GitHub's advisory doesn't attribute it to a known campaign.

Check without starting Python

  1. Any python, pip or test run in an affected environment runs the stealer again; BleepingComputer's advice is to avoid running Python or pip there until it's secured. So start with the filesystem. Our command finds the hook files, the installed versions and uv's cached wheels. Run it on laptops, build agents and self-hosted runners, as root to cover every user. Pass: no output:

    find / \( -name 'agent_framework-1.26.[12].dist-info' -o -name agent_framework_meta.pth -o -name af_runtime_diag.pth -o -name af_runtime_diag.py -o -path '*/agent-framework/1.26.[12]-*' \) -print 2>/dev/null

    Our note: none of the write-ups describe anything installed outside the package files, so a deleted venv or a fresh hosted runner leaves nothing to find. No output means it isn't there now, not that it never ran. The logs below answer that.

  2. Installed version in one project, still without Python. Pass: no 1.26.1 or 1.26.2:

    ls -d .venv/lib/python3*/site-packages/agent_framework-*.dist-info 2>/dev/null

    pip show agent-framework and pip freeze | grep -i agent-framework say the same, but pip starts Python. Use them only on environments the find above cleared.

  3. Lockfiles and requirements, from the repo root. The first command matches pinned versions in requirements and pyproject.toml, the second the version lines in uv.lock and poetry.lock, the third the two malicious wheel hashes from the advisory in any file that records hashes. Pass: no output:

    grep -rn -E 'agent[-_]framework[=-]=?1\.26\.[12]' --include='*.txt' --include='*.in' --include='*.toml' .
    grep -rn -A1 'name = "agent-framework"$' --include='*.lock' . | grep -E '1\.26\.[12]'
    grep -rn --exclude-dir=.venv --exclude-dir=node_modules -E 'd27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110|3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9' .

    A hash-pinned install of 1.26.0 never pulled either release. An unpinned agent-framework resolved while they were up (from 20:35 UTC on Nov 17) could have.

  4. CI logs since Nov 17. pip prints agent-framework-1.26.1, uv prints agent-framework==1.26.1, downloads show agent_framework-1.26.1-py3-none-any.whl; the pattern matches all three. Our command for GitHub Actions, per repo. Pass: no output:

    gh run list --created '>=2026-11-17' -L 500 --status completed --json databaseId -q '.[].databaseId' | while read id; do gh run view "$id" --log 2>/dev/null | grep -E 'agent[-_]framework(==|-)1\.26\.[12]' | sed "s/^/run $id: /"; done

    Use the same pattern on Azure Pipelines, GitLab or any other CI log export. Our note: search past Nov 17, because a cache saved that evening reinstalls the same files later without asking PyPI.

  5. Caches and images. A CI cache saved in that window (pip, uv or a whole .venv) and any image built from it still hold the release. Our commands: list Actions caches created since Nov 17, then look inside an image without starting its Python (needs find in the image; our box has no Docker, so this one wasn't run here):

    gh cache list -L 100 --json id,key,createdAt -q '.[] | select(.createdAt >= "2026-11-17") | "\(.id) \(.createdAt) \(.key)"'
    docker run --rm --entrypoint find IMAGE / \( -name 'agent_framework-1.26.[12].dist-info' -o -name agent_framework_meta.pth -o -name af_runtime_diag.pth \) -print

    Delete caches you can't vouch for (gh cache delete <id>), rebuild images from a clean base with agent-framework==1.26.0, and clear local caches with pip cache purge and uv cache clean agent-framework.

  6. Did it send anything? Both releases POST to the same webhook.site URL. Search proxy, DNS or firewall logs for its path and the User-Agents (af-runtime-diagnostics/1 in 1.26.1, runtime-diagnostics/1 in 1.26.2; the pattern matches both). Pass: no output:

    grep -rn -E 'd381fd80-ec62-42ad-8f5c-d1b15103c9bb|runtime-diagnostics/1' /path/to/egress-logs

    BleepingComputer: distinguish blocked requests from completed transfers. A lookup of the domain alone doesn't show that the upload went through. Elastic's advice holds either way: treat everything readable on the host as compromised.

What it takes

From GitHub's advisory and Elastic's analysis:

  • Host context: hostname, user, working directory and command-line arguments.
  • Environment variables whose names contain TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, HF_, OPENAI, NPM, PIP or CI_ (the advisory's list), plus the environments of up to 300 other running processes through /proc/*/environ (Elastic). Our note: so the keys in a dev server or agent running beside it count too.
  • Files across every home directory and /root (Elastic): Azure CLI token caches in ~/.azure, .npmrc, .netrc, .git-credentials, Docker's config.json, the Hugging Face token, Azure Pipelines agent .credentials, and .env files under /app and /workspace.
  • Fresh tokens: Azure managed-identity tokens from the instance metadata service for 12 resources, including Resource Manager, Graph, Key Vault and Storage; an Azure DevOps pipeline OIDC request (Elastic notes it omits the documented serviceConnectionId, so it may not return a usable token). 1.26.2 adds GitHub Actions OIDC tokens for api://AzureADTokenExchange and https://management.azure.com/, and /home/runner paths.
  • All of it goes out in one POST, zlib-compressed and Base64-encoded.

Rotate and prove the old values are dead

  1. Rebuild first, then rotate from a machine that never ran it: delete the venv or image and reinstall with agent-framework==1.26.0, then replace everything on the list above. That means Azure and AWS keys, GitHub and git credentials, npm, PyPI, NuGet and Docker tokens, the Hugging Face token, OpenAI and other AI keys, every .env value, and the secrets of any CI job that installed it.

  2. Short-lived tokens can't be revoked. Elastic: "review activity for short-lived tokens that can't be revoked." Our note: for Azure, that means sign-in and activity logs for each managed identity and federated credential the affected VMs, App Services, pipelines and workflows could reach.

  3. Prove each old value fails. Pass: 401 or 403. Our commands; put the old value in OLD first (for Docker, also your Docker Hub username):

    curl -s -o /dev/null -w '%{http_code}\n' https://api.github.com/user -H "Authorization: Bearer $OLD"
    curl -s -o /dev/null -w '%{http_code}\n' https://registry.npmjs.org/-/whoami -H "Authorization: Bearer $OLD"
    curl -s -o /dev/null -w '%{http_code}\n' -u "YOUR_DOCKER_USER:$OLD" 'https://auth.docker.io/token?service=registry.docker.io'
    curl -s -o /dev/null -w '%{http_code}\n' https://huggingface.co/api/whoami-v2 -H "Authorization: Bearer $OLD"
    curl -s -o /dev/null -w '%{http_code}\n' https://api.openai.com/v1/models -H "Authorization: Bearer $OLD"
    curl -s -o /dev/null -w '%{http_code}\n' https://api.anthropic.com/v1/models -H "x-api-key: $OLD" -H 'anthropic-version: 2023-06-01'

    Each of these returned 401 for a made-up key on our box on Nov 19. There's no Azure DevOps line on purpose: a made-up PAT got a 302 redirect, not a 401, so a curl can't prove it dead. Check that the old PAT is gone from the token list instead, and read each AI provider's usage page for calls that aren't yours.

Hardening: what the docs offer

Related: wfx-loot (a CI secret stealer pushed with stolen GitHub tokens), AGENTS.md malware (repo files telling your coding agent to run a stealer) and Host leaked your AI key (asking OpenAI or Anthropic for a refund after a leak).

  • Install from hashes. pip's secure-installs docs: --require-hashes (all or nothing; every requirement pinned with == and a --hash) plus --only-binary :all:. uv has the same as require-hashes under [tool.uv.pip]. Our note: hashes stop a changed file under a version you already locked; they don't stop you from locking a bad new version.
  • Wait before taking new releases. Elastic suggests a delay. uv's exclude-newer accepts a duration, compared against each file's upload time: exclude-newer = "7 days" under [tool.uv]. The current pip docs list --uploaded-prior-to P7D. Our note: a 7-day delay would have skipped both releases, which were up for under an hour.
  • Python is retiring this hook. Python's site docs: import lines in .pth files are deprecated since 3.15 but still executed, and will be silently ignored in 3.18 and 3.19. Every Python you run today still executes them.
  • If you publish packages. PyPI's Trusted Publishing swaps long-lived API tokens for short-lived OIDC tokens issued to your CI. Our note: it removes one token a stealer can take. Nobody has said how the attacker got publish access here, so don't read it as the fix for this incident.

Ship Check Kit · $29

Rather not run it by hand?

The Ship Check Kit doesn't detect this malware on a laptop, runner, cache or image; use the commands above for that. What it covers, run by your coding agent on your app: SC-DEP-01 runs osv-scanner on your lockfile, and in our test a requirements file pinned to 1.26.1 came back as a WARN with 2 advisories, not a FAIL, so read its warnings. SC-SEC-01 finds secrets anywhere in git history, SC-SEC-03 fails while any old value still gets anything but a 401 or 403, and SC-AI-02 fails any AI provider without a spend ceiling and alert. Four of 44 launch checks, each with the evidence and the fix.

Checked against Elastic Security Labs: We caught the agent-framework PyPI compromise six minutes after it published (Nov 18), BleepingComputer: Microsoft's Agent Framework PyPI package compromised to steal credentials (Nov 18), GitHub Advisory GHSA-764m-3ppc-5m73: Malicious code in agent-framework (PyPI), The Register: Microsoft statement (Nov 18), pip docs: Secure installs, pip docs: pip install (--uploaded-prior-to), uv docs: Settings (exclude-newer, require-hashes), Python docs: site (.pth files), PyPI docs: Trusted Publishers on 2026-11-19. Only test apps and accounts you own or are allowed to test.