Two releases of Microsoft’s official agent-framework package on the Python Package Index contained credential-stealing code. Versions 1.26.1 and 1.26.2 executed a startup hook when Python launched, even if developers never imported the framework. The code collected secrets, cloud and developer credentials, environment files and information from other processes before sending the haul to an external endpoint. The package repository quarantined both releases, but the method used to obtain publishing access remains unexplained.

What Happened

Versions 1.26.1 and 1.26.2 of Microsoft’s official agent-framework package on the Python Package Index were published with credential-stealing code on November 17. Agent Framework is an open-source toolkit for building AI agents and running them in workflows. The package reportedly receives 192,534 monthly downloads, giving the malicious releases potentially broad reach, although the supplied evidence does not state how many installations occurred.

The malicious payload was installed as a Python .pth startup hook. That detail matters because Python processes these hooks when the interpreter starts. The framework did not need to be imported for the code to run in an affected environment. Both releases also retained their dependency on the genuine agent-framework-core 1.26.0, allowing expected framework functions to continue while the stealer operated in the background.

The first malicious release was quarantined, but version 1.26.2 was then uploaded, demonstrating that the publisher still had access at that point. The second release restored Microsoft’s original package initializer and moved the malicious hook into a file named af_runtime_diag.pth, making the change harder to notice. Both releases were subsequently quarantined. Version 1.26.0 was identified as the last clean release.

The code searched environment variables for names containing terms such as TOKEN, SECRET, AZURE, AWS and GITHUB. It read the environments of up to 300 other processes and copied .env files along with credential files associated with Azure CLI, pip, npm, Git, Docker and Hugging Face. It also attempted to request fresh Azure managed-identity, CI federation and GitHub Actions OIDC tokens. The evidence cautions that attempts to request these tokens do not confirm that tokens were issued.

Collected material was compressed, encoded and sent to a webhook.site endpoint. None of the cited reports explained how the attacker obtained publishing rights to the official package.

Why It Matters

This incident reaches beyond ordinary developer workstation malware. Package installation is a trusted step in software delivery, and the startup-hook technique allowed the code to execute whenever Python launched. A developer or build process could therefore activate the payload without directly using the compromised framework.

Build runners often have access to source repositories, package registries, deployment systems and cloud identities. They may also be able to request short-lived tokens through federation or managed identities. That means rotating stored passwords and keys may be incomplete if an attacker obtained active tokens or retained a path to request new ones.

The continued operation of the genuine framework reduced the chance that users would notice an obvious failure. This is a common supply-chain danger: malicious behavior can be added while the expected software still works. The official package name also creates a powerful trust signal that can weaken scrutiny.

For leaders, software dependency controls should cover provenance, approved versions and the identity permissions available during builds. For defenders, incident response must include hosts, ephemeral runners, cloud roles, federated credentials and outbound network activity. The security boundary is the full build environment, not only the package file.

What to Watch

The unresolved question is how the attacker obtained publishing rights. Watch for an authoritative explanation from Microsoft or the package repository because the answer could affect confidence in related accounts, tokens or release processes. Until that is known, organizations should avoid assuming the incident was limited to a simple package mistake.

Teams should determine whether either malicious version was installed on developer workstations, persistent build servers, ephemeral runners or container images. Installation records and dependency lock files may help establish scope. Because the hook ran when Python started, execution could have occurred even without an application importing the framework.

Cloud and identity logs should be reviewed for unexpected token requests and use. The evidence confirms that the malware attempted to request fresh tokens but does not confirm successful issuance in every environment. Investigation should preserve that distinction while still treating exposed systems seriously.

Organizations should also look for downstream artifacts built or published from affected environments. The supplied evidence does not establish downstream compromise, but affected build systems may hold privileges that warrant review.

What Defenders Should Do

Containment: Isolate any host or runner that installed versions 1.26.1 or 1.26.2 before launching Python or pip again. Preserve relevant evidence where incident procedures require it.

Rebuild: Recreate affected environments from a known-clean base and pin the package to the last identified clean release, version 1.26.0, unless updated official guidance provides another safe version.

Credential response: Treat every secret reachable from the affected system as potentially compromised. Review stored keys, active sessions, OIDC permissions, federated credentials and managed-identity role assignments. Remember that rotating stored secrets may not revoke tokens already issued.

Dependency controls: Install dependencies through an internal mirror of approved versions rather than directly from a public index. Use lock files and controlled promotion processes to reduce surprise updates.

Build hardening: Use short-lived credentials, delete build environments after each job and restrict outbound connections to approved destinations. These controls limit what malicious dependencies can collect and where they can send it.

The Larger Lesson

A build system is part of the identity perimeter. If it can request cloud tokens, publish code or deploy workloads, it holds authority even when it stores no long-lived password. Security programs should therefore manage build runners as sensitive identities, not disposable compute alone.

The incident also shows that trusted names and official repositories are not sufficient assurance. Safer software delivery combines provenance checks, approved versions, constrained network access, short-lived identity and rapid reconstruction. The goal is to make a compromised package less able to execute, steal useful material or send it away.

Questions, corrections, or feedback about this story?Contact Daily Cyber News →

← Back to this Daily edition