Skip to content
MustHave.ai Musthave.ai
AI Tools

Microsoft Agent Framework’s PyPI compromise: what developers need to check

Two agent-framework releases contained credential-stealing startup hooks. Check the affected versions, build history, and the separate work of credential recovery.

Microsoft Agent Framework’s PyPI compromise: what developers need to check
Python startup hooks can run before an application imports the compromised framework.

A dependency can expose credentials before your application reaches the line that imports it.

Two releases of the Python package agent-frameworkused with Microsoft Agent Framework contained credential-stealing code. The public GitHub advisory identifies versions 1.26.1 and 1.26.2. Both appeared on November 17 and were subsequently removed from PyPI. The advisory identifies 1.26.0 as the preceding clean release.

The important detail is when the malicious code ran. It used Python startup files, so importing agent_framework was not necessary. A developer could install a dependency, run an unrelated Python command in that environment, and trigger the unwanted behavior. That expands the investigation beyond the application’s own execution logs.

Wiz’s original investigation and Elastic Security Labs’ separate analysis document the affected releases and the collection of developer and cloud credentials. This article uses those public investigations. We did not install or execute the malicious packages.

A short publication window can leave a longer recovery job

The advisory records the first malicious upload at 20:35 UTC on November 17. Version 1.26.2 followed at 21:08 UTC, a 33-minute gap. Elastic says its monitor detected the first release at 20:41 UTC, six minutes after publication. The researchers report that the releases disappeared from PyPI within the hour.

Those times describe package distribution. They do not tell a founder when every affected machine stopped being exposed. A downloaded wheel can remain in an artifact cache. A container image can preserve the installed package. A build runner may continue starting Python after the package has vanished from the public index.

For a small team, the practical timeline has several events: the dependency was selected, an artifact was downloaded, it was installed somewhere, and a Python process started there. Credential use can happen later. Put timestamps beside those events rather than using the removal time as the end of the incident.

The current PyPI project page lists 1.26.0. Its absence of the later releases is consistent with their removal. The advisory and original investigations provide the historical account of what those removed versions contained.

Python startup is the relevant execution boundary

Python can process .pth files in an environment’s package directory when an interpreter starts. The malicious wheels added startup hooks that loaded helper code. That mechanism explains why searching only for an explicit import agent_framework misses part of the exposure.

The advisory identifies different filenames for the two versions. Investigators should use the version-specific indicators in the linked record. A renamed file in the second release also means that finding no first-version filename is an incomplete investigation.

This distinction is useful when talking to a hosting provider or contractor. Ask which Python environments existed on the affected host, whether either version entered them, and whether an interpreter started afterward. “Our application never used that feature” answers a different question.

Keep the package name precise throughout the investigation. The advisory concerns agent-framework releases 1.26.1 and 1.26.2. Other Microsoft packages need their own version and provenance checks. A general search for “Microsoft AI” will produce a much larger and less useful set of results.

Build an exposure record before replacing the environment

The following matrix separates evidence that helps establish exposure from evidence that supports a response. It is an investigation aid derived from the documented startup mechanism.

What the records showWhat that establishesWhat to investigate next
A malicious-version wheel exists in a download cacheThe artifact reached that cache.Which jobs or environments consumed it.
A named version was installed, and Python subsequently started thereThe documented trigger could run in that environment.Reachable credentials and signs of collection or use.
The environment’s history is incompleteExposure remains uncertain.Build logs, images, lockfiles, package caches, and runner history.
The package was replaced with 1.26.0The current dependency choice changed.Whether earlier credentials or cached images still need attention.
An investigation matrix derived from the documented startup mechanism; it does not establish exposure on a particular machine.

Preserve the useful records before an environment rebuild removes them. Record the environment name, package version, relevant installation time, subsequent interpreter activity, and credentials available to that job. Avoid copying secret values into a ticket or shared spreadsheet. Credential names, scopes, owners, and rotation status are usually the useful fields.

For a reproducible build, an exact version is only part of the record. Keep the artifact hash and the source from which it came. A lockfile can help establish what the resolver selected; a build log can help establish what the runner actually installed. Investigate differences between them.

Dependency repair and credential recovery are separate tasks

Replacing a malicious package addresses future execution from that installation. It cannot recall credentials already collected. The researchers’ recovery guidance therefore includes rotating credentials and reviewing cloud identities and build systems.

Start with the credentials the affected process could reach. That includes environment variables and local credential stores described in the investigations. A CI runner may have access to a deployment identity that a developer’s laptop lacks, even when both install the same dependency.

Have the owner of each service revoke or rotate the relevant credential from a trusted environment. Keep a record of which replacement is in use and whether the old credential still works. If a temporary cloud token was involved, expiry is relevant, but a review should also consider actions taken while it was valid.

Review downstream access with the same care. A token that can publish a package or deploy a website may create a second problem outside the original Python environment. Use the service’s audit records to establish what happened. An exposed token alone does not prove that every action it permitted occurred.

Check clean rebuilds against the old delivery path

A fresh environment should come from a trusted base and an explicitly reviewed dependency set. Check whether a build cache, container layer, or internal mirror could reintroduce an affected wheel. Otherwise, a successful rebuild may reproduce the same exposure.

For example, imagine three runners share one package cache. Replacing the dependency on a developer laptop says nothing about those runners. The useful inventory connects the cache to each consumer and each consumer to its deployment credentials. That connection is more actionable than a count of machines with Python installed.

Teams can also separate build-time and deployment-time access. A task that formats code rarely needs production deployment credentials. Reducing the credentials available to a process limits what a future dependency compromise can collect. Apply that principle to the actual job permissions rather than assuming a framework provides the boundary automatically.

Make the incident record useful to the next maintainer

A clear response record should allow another person to follow the evidence from package selection to the affected environment and its recovery. Keep unresolved points visible, including missing runner logs or uncertain installation times.

The public advisory, Wiz, and Elastic establish the known package versions and the startup mechanism. Your own records establish whether those conditions existed in your systems. Combining those two kinds of evidence gives a founder a defensible scope for recovery, without treating a package downgrade as proof that the earlier exposure has been resolved.

Abdessalam Alaoui

I'm Abdessalam Alaoui, founder of Musthave.AI. I write practical guides to AI models, tools, generative media.

Join the discussion

Your email address will not be published. Required fields are marked *

Keep reading

All news