Supply Chain Compromise: The Poisoned Microsoft Agent Framework

Trace Incident Analysis Team

On November 17, two malicious versions of agent-framework, the Python package for Microsoft Agent Framework, reached PyPI and stayed up for under an hour (Wiz). Both carried a credential stealer that runs whenever Python starts, aimed at Azure managed-identity tokens, CI identity tokens, and AI provider keys. The package sees about 41,000 downloads a week, and 1.26.0 remains the last clean release.

What happened

  1. Nov 12, 18:25
    Legitimate 1.26.0 published
  2. Before release
    A publish attempt from AWS is rejected by Microsoft’s release pipeline; a second from Microsoft-owned address space succeeds
  3. Nov 17, 20:35
    Malicious 1.26.1 published
  4. Nov 17, 21:08
    Malicious 1.26.2 published
  5. Nov 17, 21:30
    Both versions gone from PyPI

Wiz says the attacker appears to have held a client certificate and key for ESRP, the internal Microsoft service that signs and publishes the package; how they were obtained is unknown. The attacker’s tooling identified itself as Cairn, an open-source AI penetration-testing framework. It staged the package in /tmp/cairn_pkg, and a test run on the attacker’s own machine captured an AI coding agent configuration that appears to be the Pi harness on a GLM model.

Each release drops a .pth file into site-packages, so the stealer runs on every interpreter start without an import. It forks into a detached session and collects secret-looking environment variables, values from up to 300 other processes’ /proc/*/environ files, and Azure managed-identity tokens for 12 resources from the metadata endpoint. Version 1.26.2 also requests GitHub Actions OIDC tokens. Everything goes in one HTTPS POST to a hardcoded webhook[.]site URL.

That webhook accepts only 100 requests. Wiz counts four from the attacker, 29 from sandboxes and scanners, and 17 representing three successful victim exfiltrations.

How it could have been caught

A trusted package that steals at startup runs inside the application’s own Python process, so the theft begins before any application code. Its outbound side is new. A baseline of an agent service would have flagged its first token requests to the metadata endpoint, seconds after a container started on the new version.

What this looks like in Trace

Here is one rollout traced in an Azure Kubernetes workload that pulled agent-framework unpinned. The file names, token targets, process reads, and webhook come from Wiz. The workload name, ancestry, and timings are illustrative.

Network trace. Workload ai/agent-service, an agent built on Microsoft Agent Framework.

  1. T+0:00
    containerd-shim → python3 (agent service)
    Destination
    Trace AI proxy
    Baseline
    Known
  2. T+0:01
    python3 → python3 (detached session, af_runtime_diag.pth)
    Baseline
    Anomaly, new ancestry
  3. T+0:02
    python3 (detached session)
    Destination
    169.254.169.254:80
    Baseline
    Anomaly, 12 token requests
  4. T+0:04
    python3 (detached session)
    Destination
    webhook[.]site:443
    Baseline
    Anomaly, never-seen destination

The agent’s own model calls keep flowing through the AI proxy as usual. The stealer makes no model calls, so the evidence comes from the sensor.

Traceback. At T+0:01 the triage agent opens a case and follows the chain:

webhook[.]site POST → detached python3 → af_runtime_diag.pth → agent-framework 1.26.2 → unpinned requirement resolved at image build, with no commit changing the version

The chain names the new package version as the only change behind the behavior.

Verdict: a supply chain compromise reaching cloud identity through an AI agent framework. The case reaches the platform team within seconds of the container starting, with the package version, the token requests, and the destination named, so the managed identity can be rotated first.

This analysis reconstructs the incident from public reporting and walks through where Trace would have raised the first alert inside the cloud of a team running Microsoft Agent Framework. Detection times are illustrative.

Read more

  1. Autonomous Exploitation: The exploit_agent Pipeline

  2. Inference Breach: NEAR AI's SGLang Server

  3. Build Escape: The Railway AI Key Theft