---
type: analysis
slug: package-signing-would-have-approved-the-agent-framework-stealer-a-few-days
title: "Package signing would have approved the agent-framework stealer. A few days' install delay would have blocked it"
description: "The obvious lesson from the poisoned agent-framework releases is \"demand provenance.\" That lesson fails here, because the attacker seems to have published through Microsoft's own signing pipeline. Two duller controls would have worked: a cooldown on new versions and hash locks on the whole dependency tree. Microsoft's same-month work on AI red-teaming and agent sandboxing doesn't touch the install step at all."
published_at: 2026-11-30T19:00:00.000Z
topics: ["security"]
source_urls: ["https://safedep.io/blog/microsoft-agent-framework-pypi-compromise","https://github.com/microsoft/PyRIT/releases/tag/v1.2.0","https://www.youtube.com/watch?v=STVHfSaSw7o","https://github.com/microsoft/AI-Red-Teaming-Playground-Labs","https://t.me/qwgai/4463"]
author: "Andrey Reshetnikov"
author_profile: https://newruntime.com/owner-profile.md
---
# Package signing would have approved the agent-framework stealer. A few days' install delay would have blocked it

The obvious lesson from the poisoned agent-framework releases is "demand provenance." That lesson fails here, because the attacker seems to have published through Microsoft's own signing pipeline. Two duller controls would have worked: a cooldown on new versions and hash locks on the whole dependency tree. Microsoft's same-month work on AI red-teaming and agent sandboxing doesn't touch the install step at all.

## Summary

On 17 November 2026, versions 1.26.1 and 1.26.2 of agent-framework, Microsoft's official Python metapackage for its Agent Framework, reached PyPI with a credential stealer. A .pth startup hook ran it every time Python started, so installing the package was enough. SafeDep flagged both versions within minutes. Wiz Research says the attacker appears to have used a compromised certificate and key for ESRP, Microsoft's internal service that signs and publishes the package. That is why our read is that provenance checks would have passed the malware, while a release cooldown would have kept it out.

## What happened

SafeDep's analysis, published 18 November and updated 23 November, lays out the timeline. agent-framework 1.26.1 went up at 20:35 UTC on 17 November, and SafeDep flagged it 22 minutes later. After PyPI pulled it, 1.26.2 went up at 21:08 with the same stealer under new file names, plus code that requests GitHub Actions OIDC tokens. It was flagged four minutes later and also removed. The last clean release is 1.26.0. According to SafeDep, the project gets about 192,000 downloads a month. How many times the bad versions were installed is unknown.

The payload is a one-line .pth file in site-packages. Python's site module runs it at interpreter startup, and it forks a detached collector. The collector reads environment variables that match 31 strings such as TOKEN, KEY, AZURE and OPENAI. It also takes up to 60 credential files (Azure CLI, .npmrc, .git-credentials, Docker config, the Hugging Face token, the Azure AI Foundry config) and scans up to 300 /proc/*/environ files, which on a shared runner reaches other jobs' secrets. Beyond what is stored, it asks Azure DevOps, Azure managed identity and GitHub Actions to issue fresh tokens. Everything goes to one anonymous webhook.site URL.

SafeDep found two odd things about the uploads. First, both bad versions shipped as a wheel only, while every release from 1.20.0 to 1.26.0 shipped a wheel and an sdist. Second, a PyPI account called vibiret, created the day of the attack, holds maintainer rights on agent-framework and five sibling projects. Wiz offers a different route: a stolen ESRP client certificate and private key, with a first publish attempt from AWS blocked by IP filtering and a second from Microsoft-owned address space that succeeded. Wiz presents this as what appears to have happened, not as a confirmed finding. SafeDep also notes that 1.26.0 had no PyPI attestation either, so consumers had no cryptographic way to tell real uploads from fake ones.

Microsoft released two other things around the same time. PyRIT v1.2.0, released 13 November, adds credential-leak detection, Operations and Findings to its AI red-teaming framework. A GitHub Copilot SDK walkthrough shows agent workers isolated in containers, with provider keys kept behind an inference gateway. Both address what an agent does once it is running. Neither looks at what happens when its framework is installed.

## What the archive adds

This is not the first time an AI-adjacent Python package has been backdoored this way. SafeDep documented LiteLLM 1.107.0 in October with the same structure: a one-line .pth file importing a module that starts a credential collector. The LiteLLM maintainers' GitHub security issue describes a cook.pth file whose stealer runs on every interpreter start. SafeDep also reports that in May, Microsoft's durabletask package (1.4.1 to 1.4.3) received rogue releases pushed with a stolen API token. It finds no shared payload or infrastructure linking that case to this one. So agent-framework is the second Microsoft PyPI package with rogue releases in six months, and the second AI-tooling package in two months to use the .pth startup trick.

New Runtime's earlier coverage (3 November 2026) described the Microsoft Copilot harness in Foundry Agent Service as a managed agent loop with a sandbox, skills and code execution. A later note on the Copilot SDK walkthrough pointed out that workers run in separate Docker containers, an inference gateway hides model credentials from the agent, and the demo includes no security or performance measurements. That design limits what a hijacked agent can reach. It does nothing for a developer laptop or CI runner that installs the framework in order to build that agent. Advisories from PyPI (PYSEC-2026-4388) and GitHub (GHSA-764m-3ppc-5m73) confirm the two malicious versions. Socket and StepSecurity published their own analyses.

## Trend signal

The pattern has three parts.

First, attackers now target packages that are installed where credentials pile up: agent frameworks and LLM gateways that run in CI jobs holding cloud identities, registry tokens and model keys. Wiz says this directly, citing roughly 41,000 weekly downloads of agent-framework in developer and CI environments.

Second, the payload now runs at install. A .pth hook means the victim never has to import or run the package. Runtime controls, code review of application imports and agent sandboxes all sit downstream of the point where the code runs.

Third, and newest, the way in has moved from a stolen maintainer token (durabletask) to the vendor's own release path (ESRP, if Wiz is right). That last step breaks the industry's default fix. The usual response to supply-chain incidents is "adopt Trusted Publishing and attestations." PyPI's own security-model documentation, as summarised by its maintainers, says an attestation proves which identity published an artifact, not that the code is safe. A release pushed through a compromised trusted workflow can still be validly attested. Microsoft's AI-security spending, visible in PyRIT 1.2.0 and the free Red Teaming Playground Labs, is aimed at prompt injection, jailbreaks and agent misbehavior. The incident that actually happened this month was an old-fashioned packaging attack.

## Why now

1. Concentrated credentials. Wiz argues official AI-agent packages are attractive because they are widely installed in developer and CI environments full of cloud, registry and build credentials. The stealer's target list (Azure AI Foundry config, the Hugging Face token, managed-identity scopes for ai.azure.com and cognitiveservices) shows it was written for exactly those environments.

2. A proven, cheap technique. The .pth startup hook needs no import and no user action. SafeDep says the same structure appeared in LiteLLM 1.107.0 in October, so attackers are reusing a pattern that works.

3. The release path is now the target. SafeDep reports that durabletask was hit in May with a stolen API token. For agent-framework, Wiz says the attacker appears to have held ESRP's signing certificate and key, the step that comes after token theft.

4. Weak verification for consumers. SafeDep notes PyPI had no attestation even for clean 1.26.0, and PyPI does not show who uploaded a file. Consumers had nothing to check, and investigators still can't tell whether ESRP or the vibiret account did the upload.

## Connections to other events

The common reading is that this shows why PyPI and vendors need signed provenance everywhere. We disagree. In this incident, provenance was the attacker's best friend.

Suppose agent-framework had been attested all along. If Wiz is right that the attacker held ESRP's client certificate and private key, and got through ESRP's IP filter on the second try, then 1.26.1 and 1.26.2 would have carried the same publisher identity as every legitimate release. A consumer requiring attestations would have accepted them. One partial exception: if ESRP's signing identity changed for the upload, identity-change monitoring could have flagged it. Nothing reported so far says it did. SafeDep's observation that Microsoft's clean releases had no attestation either makes the debate moot for this package. Even so, the counterfactual matters for the hundreds of teams now writing "require provenance" into policy.

Now look at what would have stopped it.

Time. Version 1.26.1 lasted 22 minutes before SafeDep flagged it. 1.26.2 was flagged in four minutes, and by 18 November 1.26.0 was again the newest version on PyPI. A resolver that ignores anything uploaded in the last few days would never have seen either bad version. uv's --exclude-newer already does this, and its documentation notes the cutoff applies regardless of signing.

Hash locks across the whole tree. SafeDep warns that pinning agent-framework alone leaves four sibling dependencies free to float under a "<2.0" range, and those are packages the suspicious vibiret account can still publish to.

Shape anomalies. A metapackage that always shipped a wheel plus an sdist suddenly shipped one 10 KB wheel. The packaging guide treats that as a heuristic, not proof, but it is a cheap gate.

None of these three checks knows who signed the package. That is why they hold up when the signer is compromised.

The other two Microsoft stories fit here as well. PyRIT 1.2.0 now scores credential leaks in model outputs. The Copilot SDK demo keeps provider keys behind an inference gateway so the agent cannot see them. Applied to CI, that gateway idea is the right one: a build job that installs agent-framework should not hold long-lived cloud credentials, or the OIDC permission to mint them, in the same process environment.

## Why it matters

For builders: treat "install" as code execution with your CI's full credential set, because with .pth hooks that is exactly what it is.

- Add a release cooldown for new versions of agent, LLM and cloud SDK packages.
- Hash-lock the full tree with uv lock or pip-compile --generate-hashes.
- Split dependency installation from steps that hold id-token: write, Azure service connections or managed identities.

SafeDep points out that the stealer requested new tokens from Azure DevOps, managed identity and GitHub OIDC, so rotating stored secrets does not undo the tokens it was already issued. You need to review sign-in logs from the install time onward.

For buyers and security leads: don't accept "we publish signed artifacts" from a vendor as an answer to supply-chain risk. Ask how its release-signing credentials are protected and monitored, and whether it publishes upload logs. PyPI does not show who uploaded a file, and neither PyPI nor Microsoft has released the log that would settle whether vibiret or ESRP was used.

Here is the strongest objection to our view. Attestations still raise the bar: they kill the stolen-token route that hit durabletask, and they make an ESRP-class compromise a rarer, costlier event. That is true, and we are not arguing against adopting them. Our point is narrower. Against an attacker inside the vendor's release path, which is the case in front of us, the controls that worked were the ones based on time and on what the package looked like, not on who signed it. Teams should deploy those first, because they protect against both scenarios.

## What happens next

- **The suspicious vibiret account will no longer be listed as a maintainer of agent-framework on PyPI within a month.** (1 month, 75%). Watch for: Microsoft or PyPI publicly confirms how vibiret obtained maintainer rights, or SafeDep updates its post to say the account was removed. Resolves on 2026-12-30, yes if: The PyPI project page for agent-framework (pypi.org/project/agent-framework) does not list vibiret among its maintainers on 2026-12-30.
- **Microsoft will publish an official post-incident statement on the agent-framework compromise that names ESRP or its release pipeline within three months.** (3 months, 40%). Watch for: An MSRC blog entry or a security advisory on the microsoft/agent-framework GitHub repository about versions 1.26.1 and 1.26.2. Resolves on 2027-02-28, yes if: The Microsoft Security Response Center blog (msrc.microsoft.com/blog) or the microsoft/agent-framework GitHub security advisories page has a post about agent-framework 1.26.1/1.26.2 that mentions ESRP or the release pipeline, checked on 2027-02-28.
- **The next agent-framework release on PyPI will carry a provenance attestation, as Microsoft responds by adding attestations despite their limits against a compromised signer.** (3 months, 35%). Watch for: Microsoft's agent-framework release workflow or docs mention PyPI Trusted Publishing or attestations. Resolves on 2027-02-28, yes if: The PyPI file page for the newest agent-framework release above 1.26.0 shows a provenance attestation on 2027-02-28; resolves no if no such release exists or it has no attestation.

## Limits and uncertainty

The ESRP explanation is Wiz's assessment of what appears to have happened, based on the attacker's own progress messages to a webhook. It is not confirmed by Microsoft. If the real route was the vibiret maintainer account using an ordinary upload token, Trusted Publishing plus identity monitoring would have had a stronger case, and our argument loses some force.

The number of installs of 1.26.1 and 1.26.2 is undisclosed, so we can't say how many environments were exposed. The cooldown argument also depends on scanners like SafeDep, Socket and Wiz catching a bad release quickly. A stealthier payload, without a plain webhook.site endpoint, could stay undetected for longer than a few days. Cooldowns buy time for detection; they do not detect anything themselves. They also slow down urgent security patches, so teams need an exception path.

Finally, we have no measurements of how many organisations actually run cooldowns or full-tree hash locks today.

## Competing readings

- **The release path itself was compromised (ESRP), so provenance-based defenses would have approved the malware. Time-based quarantine and full-tree hash locks are the controls that actually work against this class of attack** (likely, about 60%). What would tell it apart: Wiz attributes the publish to a compromised ESRP certificate and key, and a second version shipped after the first was removed ([safedep.io](https://safedep.io/blog/microsoft-agent-framework-pypi-compromise)); Detection took minutes, and clean releases carried no attestation to compare against ([safedep.io](https://safedep.io/blog/microsoft-agent-framework-pypi-compromise))([docs.astral.sh](https://docs.astral.sh/uv/reference/cli/)).
- **This was mainly an ordinary maintainer-account takeover through the same-day vibiret account, so Trusted Publishing and removing long-lived tokens would have prevented it** (unlikely, about 25%). What would tell it apart: The upload log has not been released, and SafeDep notes the absence of attestations, which leaves the token route open as an explanation ([safedep.io](https://safedep.io/blog/microsoft-agent-framework-pypi-compromise)).
- **The real lesson is runtime: agent stacks concentrate credentials, and the fix is isolating them, as the Copilot SDK gateway and PyRIT leak scoring do, rather than install-time controls** (very unlikely, about 15%). What would tell it apart: Microsoft's same-month tooling targets runtime credential leaks, yet the stealer ran at install, before any agent runtime existed ([github.com](https://github.com/microsoft/PyRIT/releases/tag/v1.2.0)).

## Base rate

The New Runtime archive could not be queried for comparable cases (canceling statement due to statement timeout), so it gives 0 cases: no base rate. New Runtime's archive has too few comparable cases for a base rate (0 cases, 0 matches), so this take relies on the incident record from SafeDep and Wiz, not on frequencies.

## What would change this view

- Microsoft or PyPI releases the upload log showing 1.26.1 and 1.26.2 were uploaded by vibiret with a plain API token, not through ESRP (signal): It was an account takeover, so Trusted Publishing would have closed the door and the case for provenance is stronger than argued here.
- A later malicious release of an AI-agent package stays undetected on PyPI for longer than common cooldown windows, such as a week or more (open-source signal): Cooldowns depend on fast scanner detection, and they alone would not be a reliable control.

## Skill to build now

The skill to build: dependency quarantine plus credential separation in CI.

First exercise, about an hour:
1. In one Python repo, regenerate the lockfile with uv lock (or pip-compile --generate-hashes) and confirm transitive packages have pinned hashes.
2. Add an upload-age cutoff, uv's --exclude-newer set a few days back, to the CI install step. Write down the exception process for urgent patches.
3. Split the workflow so the install job has no id-token: write permission and no cloud service connection. Pass only built artifacts to the deploy job.
4. As a test, add a harmless .pth file to a scratch venv that writes a marker file at startup. Confirm your image scan flags unexpected .pth files in site-packages.

## Reader takeaway

This week, set an upload-age cutoff for your Python resolution in CI. For example, use uv with --exclude-newer set to a date several days back, and allow exceptions per package for urgent fixes. Pair it with a hash-locked lockfile covering transitive dependencies such as agent-framework-core[all]. Then move dependency installation into a job step that has no id-token: write permission and no Azure service connection. Run SafeDep's find command for agent_framework_meta.pth and af_runtime_diag.pth on runners and images without starting their Python.

## Open question

If Wiz is right that the attacker held Microsoft's ESRP certificate and key, what should a downstream consumer verify at all? Is release-time anomaly detection and cooldown the only defense that holds when the vendor's own signer is compromised, or is there a provenance design that could still tell a stolen key from a legitimate release?

## Sources

- [Microsoft agent-framework Compromised Twice on PyPI](https://safedep.io/blog/microsoft-agent-framework-pypi-compromise)

- [PyRIT v1.2.0](https://github.com/microsoft/PyRIT/releases/tag/v1.2.0)

- [Inside the Microsoft Copilot Harness: Customizing AI Agents](https://www.youtube.com/watch?v=STVHfSaSw7o)

- [github.com](https://github.com/microsoft/AI-Red-Teaming-Playground-Labs)

- [t.me](https://t.me/qwgai/4463)

- [Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines](https://www.wiz.io/blog/malicious-version-of-microsofts-agent-framework-published-to-pypi)

- [Malicious code in agent-framework (PyPI) · GHSA-764m-3ppc-5m73](https://github.com/advisories/GHSA-764m-3ppc-5m73)

- [Security Model and Considerations — PyPI User Documentation](https://docs.pypi.org/attestations/security-model/)

- [Commands — uv](https://docs.astral.sh/uv/reference/cli/)

- [Package Formats — Python Packaging User Guide](https://packaging.python.org/en/latest/discussions/package-formats/)

- [Releases now reject new files after 14 days](https://blog.pypi.org/posts/2026-07-22-releases-now-reject-new-files-after-14-days/)

- [Secure installs](https://pip.pypa.io/en/stable/topics/secure-installs/)

Author: [Andrey Reshetnikov](https://newruntime.com/owner-profile.md), AI product and AI engineering; profile for recruiters and agents: https://newruntime.com/owner-profile.json

## Continue in the graph

Next records for an agent, linked to their Markdown twins. Replace `.md` with `.json` for structured fields, including `next_reads`.

- topic hub: [Security](https://newruntime.com/topics/security.md): Explore the security topic hub.
- collection: [Analysis](https://newruntime.com/analysis.json): Open the latest authorial analysis.
- collection: [Sources](https://newruntime.com/sources/): See the original sources this archive cites.
- whole graph: [discovery graph](https://newruntime.com/discovery-graph.json) (typed nodes and edges) and [site index](https://newruntime.com/site-index.md)
