# Microsoft's agent-framework malware: your Azure audit

Two releases of Microsoft's agent-framework reached PyPI on 17 November 2026 carrying a credential stealer that ran on every Python interpreter start and minted fresh Azure managed-identity and OIDC tokens. Wiz says the attacker appears to have compromised a client certificate and private key for Microsoft's own release pipeline, which is why pinning a trusted package name was no defence here.

- Published: 2026-11-18 · Category: Security & Compliance · Tags: Security & Compliance, Supply Chain Security, Azure, Microsoft Agent Framework, PyPI, Azure DevOps, GitHub Actions, NIS2, DORA, Sweden
- Author: Technspire AB, Stockholm (https://technspire.com)
- Canonical: https://technspire.com/en/blog/microsofts-agent-framework-malware-your-azure-audit

At 20:35:20 UTC on 17 November 2026, version 1.26.1 of `agent-framework` was published to PyPI under Microsoft's own project. It carried a credential stealer. PyPI quarantined it at 21:06:16 UTC. Two minutes and twenty-three seconds later, at 21:08:39 UTC, the attacker published 1.26.2 from the same publishing identity, with the payload extended to steal GitHub Actions OIDC tokens. That one was quarantined at 21:16:44 UTC. Those timestamps come from StepSecurity's reconstruction of the PyPI metadata, and Wiz reported both versions gone by roughly 21:30 UTC.

The last clean release is 1.26.0, published 12 November 2026 at 18:24 UTC, and PyPI's history page now shows it as the newest version with 1.26.1 and 1.26.2 absent. The package takes roughly 190,000 to 200,000 downloads a month by press counts; Wiz measured around 41,000 a week.

On 18 November, Wiz published its analysis and said something more serious than "a maintainer account got phished." Quoting Wiz directly: "The attacker appears to have compromised a client certificate and private key for Microsoft ESRP (Engineering System Release Pipeline), the internal service Microsoft uses to sign and publish this package." That is Microsoft's release machinery, not a developer's laptop. Wiz also wrote: "How the credentials were obtained is not yet known."

## The timeline, as sourced

| When (UTC) | What | Reported by |
| --- | --- | --- |
| 12 Nov, 18:24 | 1.26.0 published. Last clean release. | StepSecurity |
| 17 Nov, 20:35:20 | 1.26.1 published with a `.pth` credential stealer | StepSecurity, Wiz |
| 17 Nov, 21:06:16 | PyPI quarantines 1.26.1 | StepSecurity |
| 17 Nov, 21:08:39 | 1.26.2 published from the same publisher, adding GitHub Actions OIDC theft | StepSecurity, OX Security |
| 17 Nov, 21:16:44 | PyPI quarantines 1.26.2 | StepSecurity |
| 18 Nov | Wiz names a compromised ESRP client certificate and private key as the likely vector | Wiz |
| 18 Nov | Microsoft: "We have made some repositories private while we investigate malicious content." | The Register |

The practical exposure window is about 41 minutes, split by a two-minute gap where neither malicious version was installable. Short. Not short enough: a CI fleet that rebuilds on every merge can resolve a fresh dependency set hundreds of times in 41 minutes. All of it landed while Satya Nadella was on stage at Microsoft Ignite.

## What the payload did, and why importing nothing did not save you

The mechanism defeats the mental model most teams carry about dependency risk. The malicious wheels dropped a `.pth` file into the `site-packages` root, and Python executes lines in `.pth` files at interpreter startup, independently of any import you write. In 1.26.1 the hook was `agent_framework_meta.pth`; in 1.26.2, `af_runtime_diag.pth` loading `af_runtime_diag.py`.

So the stealer ran on every `python` invocation in that environment. Not on `import agent_framework`. On `python -m pytest`, on a container entrypoint that never touches the framework. A transitive install into a build image was enough.

What it collected, per Wiz and OSV:

- Environment variables matching a keyword list that included `TOKEN`, `SECRET`, `PASSWORD`, `KEY`, `AZURE`, `AWS`, `GITHUB`, `OPENAI`, `HF_`, `FOUNDRY`, `SYSTEM`, `BUILD` and `AGENT`. Version 1.26.2 added `ACTIONS`, `OIDC`, `RUNNER` and `ARM_`.
- Other processes' environments, by reading up to the first 300 `/proc/*/environ` files where permissions allowed. On a shared build agent that reaches other people's jobs.
- Credential files: `~/.azure/`, `.npmrc`, `pip.conf`, `.netrc`, `.git-credentials`, `.docker/config.json`, Azure DevOps agent credentials, and `.env` and JSON files under `/app` and `/workspace`.
- Freshly minted tokens. Not stored secrets: new ones. Azure DevOps OIDC where `SYSTEM_ACCESSTOKEN` and `SYSTEM_OIDCREQUESTURI` were present, and Azure managed-identity tokens from IMDS at `169.254.169.254` or the App Service endpoint, for a list Wiz counted at twelve resources (ARM, Microsoft Graph, Key Vault, Storage, Cognitive Services, Azure AI and ML, Container Registry, Azure DevOps, `api://AzureADTokenExchange` among them). Version 1.26.2 added GitHub Actions OIDC.

Everything was zlib-compressed, base64-encoded and POSTed to a free `webhook.site` endpoint: `webhook[.]site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb`, with user-agent `af-runtime-diagnostics/1` in 1.26.1 and `runtime-diagnostics/1` in 1.26.2.

That choice of endpoint is the only lucky part. The webhook.site free tier caps at 100 requests and returns HTTP 410 or 429 beyond it. Wiz retained a maximum of 50 requests and attributed 17 to three unique cases of real victim data; the rest was the attacker's own testing, sandboxes and vendor scanning. Three confirmed victims is a sample, not a census. The cap also means some attempts failed after the payload had already harvested secrets locally, which changes how you read your egress logs.

## Why a compromised release pipeline is a different problem

A typosquat is a name problem. You defend against `agent-frameworks` or `agentframework` by resolving from a manifest you reviewed and by blocking newly registered package names at the proxy. That defence does nothing here. The name was right. The project was right. The publishing identity was Microsoft's.

A hijacked maintainer account is an account problem with a standard recovery: revoke the token, reset the account, the attacker is out. Look at what happened instead. PyPI quarantined 1.26.1 and, per OX Security as reported by The Register, the release was reverted to a safe version. The attacker then published 1.26.2 through Microsoft's official publisher account two minutes later. Whatever was revoked in that window, it was not what the attacker held.

Now the uncomfortable detail. Check the PyPI project page for `agent-framework` and it reads "No provenance found" and "Uploaded using Trusted Publishing? No", with files "Uploaded via RestSharp/106.13.0.0". Microsoft signs and publishes this package through ESRP, which uploads with an API token rather than through PyPI's OIDC-based Trusted Publishing. So there were no PyPI attestations on the clean releases and none on the malicious ones.

That cuts both ways. A team verifying PyPI provenance attestations would not have been protected, because there was nothing to verify on any release of this package. A team reasoning "it comes from Microsoft's signing pipeline, therefore it is fine" was trusting exactly the thing that was compromised.

Provenance tells you where an artifact came from, not whether it is safe. When the origin itself is compromised, a valid provenance chain is a confident assertion of the wrong thing. The only check that would have stopped this is the one that cares about the bytes rather than the publisher. A hash pin on 1.26.0 would have rejected both malicious releases without knowing anything about Microsoft, ESRP or `.pth` files. We made the same argument when [LiteLLM 1.107.0 shipped malware](/en/blog/litellm-1-107-0-was-malware-your-azure-ai-gateway-audit).

## Did you pull it? The audit

Start with the window: anything that resolved Python dependencies between roughly 20:30 and 21:20 UTC on 17 November 2026 is in scope. Repositories locked to 1.26.0 are not, and that is worth confirming rather than assuming. Search the artifacts, not just the source, because a lockfile that says 1.26.0 today may have been regenerated since.

```
# 1. Manifests and lockfiles across every repo
grep -rniE 'agent[-_]framework.{0,12}1\.26\.[12]' . \
  --include='*.txt' --include='*.lock' --include='*.toml' \
  --include='*.json' --include='*.cfg'

# 2. Running hosts, built images, dev containers, notebook kernels
find / -xdev \( -name 'agent_framework_meta.pth' \
  -o -name 'af_runtime_diag.pth' \
  -o -name 'af_runtime_diag.py' \) 2>/dev/null

# 3. Inside an image layer without running it
docker run --rm --entrypoint sh myimage:tag -c \
  'ls -1 $(python -c "import site;print(site.getsitepackages()[0])") | grep -i "\.pth$"'

# 4. Confirm the installed version
pip show agent-framework 2>/dev/null | head -3
```

Then the CI history, where the real exposure sits. In GitHub Actions the runs that matter most are those with `id-token: write` permission, because 1.26.2 specifically targeted the Actions OIDC token service; Wiz calls those out as the priority audit set.

```
# Azure DevOps: runs in the exposure window
az pipelines runs list --org https://dev.azure.com/yourorg --project YourProject \
  --query "[?finishTime>='2026-11-17T20:25:00Z' && queueTime<='2026-11-17T21:25:00Z']
           .{id:id, pipeline:definition.name, queued:queueTime}" -o table

# GitHub Actions: workflow runs in the window, then grep the install logs
gh run list --limit 200 --json databaseId,name,createdAt,conclusion \
  --jq '.[] | select(.createdAt >= "2026-11-17T20:25:00Z"
        and .createdAt <= "2026-11-17T21:25:00Z")'
```

Do not stop at "we have no record of installing it." Check the caches. Azure Pipelines caching tasks, the GitHub Actions `setup-python` pip cache, a self-hosted agent's `~/.cache/pip` and any Azure Artifacts upstream that proxied PyPI in the window can all hold a malicious wheel after PyPI removed it. Quarantine on PyPI does not reach into your cache. The wheel hashes are `d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110` (1.26.1) and `3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9` (1.26.2).

Then the network evidence. The exfiltration host is a single known value, which makes it the cleanest signal you have.

```
// Azure Firewall / proxy logs: contact with the exfil host
AZFWApplicationRule
| where TimeGenerated between (datetime(2026-11-17 20:00) .. now())
| where Fqdn has "webhook.site"
| project TimeGenerated, SourceIp, Fqdn, Action, Protocol, Rule_Collection

// Managed identity token issuance from build subnets after the window
AADManagedIdentitySignInLogs
| where TimeGenerated > datetime(2026-11-17 20:30)
| summarize Tokens = count(), Resources = make_set(ResourceDisplayName, 20),
            IPs = make_set(IPAddress, 20)
    by ServicePrincipalId, ServicePrincipalName
| order by Tokens desc
```

Both StepSecurity and Wiz make the same point about reading these logs, and it is easy to get backwards: a DNS lookup or a TLS connection to webhook.site does not prove data left. Check the HTTP status. A 200 means the POST was accepted; a 410 or 429 means the free-tier cap rejected it. Absence of a 200 is good news about this attacker's infrastructure and no news at all about whether your secrets were read on the host.

## What to rotate if you were exposed

Treat any secret present in the environment, in a mounted file, or in a sibling process on an affected host as disclosed. Wiz notes stolen Azure tokens can stay valid for up to 24 hours, so revocation matters as much as reissuing.

| Credential | Action |
| --- | --- |
| Azure CLI session (`~/.azure/`) | Revoke refresh tokens for the signed-in principal, re-authenticate, and check Entra sign-in logs for that principal from unfamiliar IPs. |
| Managed identity | You cannot rotate it. Review what it could reach, check resource logs for use of those twelve audiences, and cut its role assignments. |
| Azure DevOps PATs and service connections | Revoke and reissue. Audit the target subscription for unexpected deployments. |
| Entra federated credentials | List federated credentials on affected app registrations and remove anything you did not add. |
| Registry credentials (`.npmrc`, `pip.conf`, `.docker/config.json`) | Rotate. These are publish credentials, which is how one compromise becomes two. |
| Model provider keys | Rotate. The keyword list explicitly included `FOUNDRY`, `OPENAI` and `HF_`. |
| Git credentials (`.git-credentials`, `.netrc`) | Rotate and review repository access logs. |

The managed-identity row is the one that stings. A managed identity has no secret for you to change, so the only remediation is scope reduction after the fact. If a build agent's identity holds Contributor on a subscription because that was convenient in 2024, this is the argument for fixing it.

## Hardening for the next one

Four controls would have changed the outcome, in rough order of effort against payoff.

**Pin by hash, not by version.** This is the one that stops the attack. A version pin of `agent-framework==1.26.0` would have held, but only because the attacker incremented rather than replaced. A hash pin holds regardless of what gets published under that name.

```
# Generate hashes once, from a resolution you reviewed
uv pip compile requirements.in --generate-hashes -o requirements.txt

# Then make the build fail on any artifact that does not match
pip install --require-hashes -r requirements.txt

# Or with uv's lockfile, refuse to update it during CI
uv sync --locked
```

`--require-hashes` requires every dependency to be pinned, transitive ones included, and upgrades become a deliberate step rather than a side effect. The trade is a slower upgrade cadence against the ability to say what bytes your production image contains.

**Resolve through a private feed with a delay.** Point builds at an Azure Artifacts feed with a PyPI upstream rather than at PyPI directly. By itself that is a caching convenience, and as the note above shows it can even preserve a malicious wheel. It becomes a control when you add a quarantine period, so a release must exist publicly for some hours before builds can resolve it. A 41-minute exposure window is entirely absorbed by a 24-hour hold. The cost: you cannot consume a same-day security patch without an override path, so build the override path first.

**Egress controls on build agents.** The payload needed to reach `webhook.site`. A build agent in a subnet with an Azure Firewall rule allowing PyPI, your registries and your own endpoints, and denying the rest, turns a successful credential harvest into a failed exfiltration. Most organisations have this for production subnets and not for build subnets, which is backwards: the build subnet is where the credentials that reach production sit in plain environment variables.

**Dependency change review as a gate.** Make a lockfile diff a reviewable event. GitHub's dependency review action and Azure DevOps branch policies can both block a merge where a dependency version moved without a human looking. That would not have stopped a build resolving dependencies at install time, but it does stop the quiet lockfile bump nobody reads. The adjacent failure mode is in our write-up of [how a malicious repo can hijack a coding agent](/en/blog/gitspawn-malicious-repo-can-hijack-your-coding-agent): a trusted-looking input reaching an execution context with credentials in it.

One thing not to do: treat a vendor's reputation as a tier in your trust model. "Microsoft publishes it, so we skip the review" was a defensible shortcut on 16 November.

## What this triggers under Swedish and EU rules

For a Swedish entity in scope of cybersäkerhetslagen (2025:1506), which entered into force on 15 January 2026, two things are live.

The first is risk management. The law's catalogue of required measures names "säkerhet i leveranskedjan", supply chain security, as a component rather than an optional extra. Its parent provision is NIS2 Article 21(2)(d), and Article 21(3) goes further: entities must "take into account the vulnerabilities specific to each direct supplier and service provider and the overall quality of products and cybersecurity practices of their suppliers and service providers, including their secure development procedures". A package pulled from a public registry into a production build is a direct supplier relationship in substance, whatever your vendor register says. If that register lists cloud providers but not the package registries your builds resolve from, there is the gap.

The second is reporting, and the clocks are tight. Under 2 kap. 5 § of the Swedish act, an operator must inform the designated authority of a significant incident "så snart det kan ske, dock senast 24 timmar efter det att verksamhetsutövaren har fått kännedom om incidenten": no later than 24 hours after becoming aware. The fuller report follows under 2 kap. 6 § within 72 hours for most entities, and a final report under 2 kap. 8 § within one month. Those mirror NIS2 Article 23(4).

Most organisations will conclude this was not a significant incident for them, because no exfiltration succeeded and no in-scope service was disrupted. Document that conclusion and the evidence behind it. A reasoned non-notification you can show an authority is defensible; a silence you cannot explain is not.

For a DORA-regulated financial entity the framing differs, because DORA cares about the function rather than the component. Under Article 17 a major incident at a critical ICT third-party provider that affects your critical or important functions must be reported by you even if you only learned of it indirectly. Article 19 reporting runs in three stages: an initial notification within four hours of classifying the incident as major (and within 24 hours of becoming aware), an intermediate report within 72 hours, and a final report within one month. Classification starts the four-hour clock, so what you want ready in advance is the classification criteria, not the notification template.

## What Microsoft has and has not said

Keeping the record straight matters, because the attribution is doing a lot of work.

**Confirmed by PyPI and the advisory databases:** versions 1.26.1 and 1.26.2 existed, contained malicious code, and are gone. The OSV entry is MAL-2026-20101, aliased to PYSEC-2026-4388, credited to Amazon Inspector, OX Security and the analyst Kamil Mańkowski.

**Reported by Wiz, not confirmed by Microsoft:** that the vector was a compromised ESRP client certificate and private key, that a first publish attempt from AWS was rejected by ESRP's IP filtering, and that a second from Microsoft-owned IP space succeeded. Wiz's own wording is "appears to have compromised". The attacker's tooling identified itself as Cairn, an open-source AI penetration-testing framework, which tells you about the tools rather than who used them.

**From Microsoft:** one statement to The Register, that it has "made some repositories private while we investigate malicious content" and that its "priority is to protect customers and the broader ecosystem". The `microsoft/agent-framework` GitHub repository still returns a 404. We found no dedicated MSRC advisory and no Microsoft confirmation of the ESRP theory.

**Unknown:** how the signing credentials were obtained, whether other ESRP-published packages across PyPI, npm and NuGet were touched, and whether the repositories taken private relate to this campaign. Do not assume `agent-framework` was the only package involved. Build the incident narrative on what you can see in your own logs.

## The checklist

- Grep every manifest, lockfile and built image for 1.26.1 or 1.26.2, and for `agent_framework_meta.pth` and `af_runtime_diag.pth`.
- List Azure DevOps and GitHub Actions runs between 20:30 and 21:20 UTC on 17 November 2026 that installed Python dependencies. Prioritise workflows with `id-token: write`.
- Purge pip caches, pipeline caches and Azure Artifacts upstream copies. PyPI quarantine did not clear your cache.
- Query firewall and proxy logs for `webhook.site`, reading the HTTP status rather than the connection.
- Rotate everything on the table above for any host or agent that resolved dependencies in the window, and check Entra federated credentials for anything added since 17 November.
- Decide and record whether this is a significant incident under cybersäkerhetslagen or a major ICT incident under DORA, with the evidence.
- Move the Python builds you care about to `--require-hashes` or `uv sync --locked`, and put an egress deny rule on the build subnet.

If you are running Python agent workloads on Azure and want help pinning the dependency chain and tightening what a build agent's identity can reach, that is the work we do in [Azure AI integration engagements](/en/services/azure-openai-integration).

## Sources

- [Wiz: 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)
- [StepSecurity: Microsoft agent-framework PyPI Package Compromised](https://www.stepsecurity.io/blog/microsoft-agent-framework-pypi-package-compromised)
- [The Register: Microsoft's official Python agent framework hijacked to distribute malware](https://www.theregister.com/security/2026/11/18/microsofts-official-python-agent-framework-hijacked-to-distribute-malware/)
- [BleepingComputer: Microsoft's Agent Framework PyPI package compromised to steal credentials](https://www.bleepingcomputer.com/news/security/microsofts-agent-framework-pypi-package-compromised-to-steal-credentials/)
- [The Hacker News: Attackers Compromise Microsoft's Agent Framework PyPI Package to Steal Cloud Credentials](https://thehackernews.com/2026/11/attackers-compromise-microsofts-agent.html)
- [Socket: agent-framework PyPI package compromised with credential stealer](https://socket.dev/blog/agent-framework-pypi-package-compromised-with-credential-stealer)
- [OSV: MAL-2026-20101, malicious code in agent-framework (PyPI)](https://osv.dev/vulnerability/MAL-2026-20101)
- [PyPI: agent-framework release history](https://pypi.org/project/agent-framework/#history)
- [Sveriges riksdag: Cybersäkerhetslag (2025:1506)](https://www.riksdagen.se/sv/dokument-och-lagar/dokument/svensk-forfattningssamling/cybersakerhetslag-20251506_sfs-2025-1506/)
- [NIS2 Directive, Article 21 (cybersecurity risk-management measures)](https://www.nis-2-directive.com/NIS_2_Directive_Article_21.html)
- [NIS2 Directive, Article 23 (reporting obligations)](https://www.nis-2-directive.com/NIS_2_Directive_Article_23.html)
- [DORA incident reporting: timelines and templates](https://www.regulation-dora.eu/dora-incident-reporting)

---

Technspire AB builds AI agents, Azure OpenAI solutions, and production web platforms for Swedish and EU enterprises. Book a call: https://calendly.com/technspire · hello@technspire.com · More articles: https://technspire.com/en/blog · Site overview for agents: https://technspire.com/llms.txt
