AIDEFEND in Action AIA-0155 Incident

Microsoft agent-framework on PyPI: Two Rogue Releases Run a Credential Stealer at Every Python Start

On November 17, 2026, two malicious releases of agent-framework, the PyPI meta-package that installs Microsoft Agent Framework (Microsoft's open-source Python SDK for building AI agents), were published 33 minutes apart: 1.26.1 at 20:35 UTC and 1.26.2 at 21:08 UTC. Each added a .pth startup hook, so a credential stealer ran whenever Python started in that environment, with no import of the framework. It collected secrets from environment variables, other processes and credential files, requested fresh Azure and CI identity tokens, and sent everything to a webhook.site URL. PyPI quarantined both versions, yet the second appeared 2 minutes 23 seconds after the first was quarantined. Wiz found only three unique cases of victim data among the 50 requests the URL stored. How the attacker obtained publishing access is not confirmed.

Supply Chain CompromiseCredential TheftPackage VettingCredential GovernanceAI Supply Chain
10 applicable AIDEFEND defenses
Source: Microsoft agent-framework Compromised: Credential Stealer Targets Azure and CI Pipelines 
Authors: Rami McCarthy, Scott Piper, Benjamin Read (Wiz)
Original article: Nov 17, 2026

Threat Analysis

  • What happened. agent-framework is the package that Microsoft's quick-install instructions recommend for Microsoft Agent Framework, its open-source Python SDK for building AI agents. The package holds almost no code of its own and pulls in agent-framework-core. On November 17, 2026, two releases appeared on the official PyPI project: 1.26.1 at 20:35:20 UTC and 1.26.2 at 21:08:39 UTC. JFrog's reading of the archive metadata shows that Microsoft's pipeline did not build them: each was a repacked copy of the clean 1.26.0 wheel with a credential stealer added. The dependency on agent-framework-core 1.26.0 was left alone, so the framework installed and ran as usual.
  • Why no import was needed. Each wheel placed a .pth file in site-packages, the directory where Python keeps installed packages. Python reads .pth files at every interpreter start and executes any line that begins with import. Installing the wheel runs nothing, but the next python, pytest or pip command in that environment starts the stealer. It detaches into the background and suppresses its errors, and it leaves no marker on disk, so each separate Python launch collects again.
  • What it took and what it asked for. The collector gathered environment variables whose names suggest secrets, the environments of up to 300 other processes on Linux, and up to 60 credential files (80 in 1.26.2): Azure CLI token caches, package-registry and Git credentials, Docker configuration, Hugging Face tokens and Azure DevOps agent credentials. It then requested new tokens: Azure managed-identity tokens for 12 resources, an Azure DevOps OIDC token and, in 1.26.2, GitHub Actions OIDC tokens. Everything left in one HTTPS POST to a fixed webhook.site URL, with no retry and no second channel.
  • The second release came 2 minutes 23 seconds after the first quarantine. According to the release records StepSecurity read from PyPI, 1.26.1 was quarantined at 21:06:16 UTC and 1.26.2 was live at 21:08:39 UTC. The stealer had moved to new file names and the modified __init__.py was back to its clean content, so a check keyed on the first version's files or diff would pass the second. PyPI quarantined 1.26.2 at 21:16:44 UTC. Taking a release down did not take publishing access away from the attacker.
  • What the evidence shows and what it does not. Wiz read the attacker's webhook URL and found 50 stored requests: four from the attacker's own machines, 29 from sandboxes and scanners, and 17 that represent three unique cases of victim data. Static analysis shows that tokens were requested, not that they were issued, and no public source so far reports later use of stolen credentials. On the publishing path, Wiz assesses that the attacker appears to have used a compromised client certificate and private key for ESRP, Microsoft's internal signing and publishing service; SafeDep notes a maintainer account that joined PyPI the same day, whose role is unknown. SecurityWeek reports that a project maintainer confirmed the removal and an investigation; as of November 24, Microsoft had not published a root cause. PyPI's record for the clean 1.26.0 shows the same uploader client string that StepSecurity recorded for the malicious wheels, and no provenance, so upload metadata could not tell the releases apart.

Applicable AIDEFEND Defenses (10)

AID-H-003.001
Software Dependency & Package Security
Very High
Consumer builds, container images and developer environments should install only the exact versions and hashes recorded in a reviewed lock file, from a controlled mirror, with implicit upgrades blocked. An environment locked to the 1.26.0 hash could not resolve to 1.26.1 or 1.26.2 while they were live. Lock the whole dependency tree, not one line: SafeDep notes that the clean 1.26.0 still accepts any release below 2.0 of four sibling packages. A signature or provenance check would not have separated these uploads, because PyPI holds no attestation for the clean 1.26.0 either. This stops the install step only where direct installs from the public registry are blocked, and a lock update has to be treated as a reviewed change.
AID-I-001.004
Sandbox Network Egress Restrictions
Very High
The stealer makes one HTTPS POST to a hardcoded webhook.site URL, with no retry and no second channel. Where CI jobs, build containers and agent sandboxes run with outbound connections blocked by default and only an allowlist of destinations permitted, enforced outside the process that runs Python, that request fails and the collected data stays on the host. StepSecurity states that with webhook.site outside the allowlist, an enforced egress policy blocks the payload's request. The policy has to be in force before the first Python start after installation. It does not remove the hook, and it does not cover developer laptops that have no enforced egress boundary. Runners and sandboxes that have no reason to use the host's managed identity should also be denied link-local and cloud-metadata addresses by the outbound policy enforced outside the sandbox, so that the request to 169.254.169.254 fails before a token is issued. This removes only one of the collector's token sources. Workloads that legitimately use a managed identity, App Service identity endpoints and the CI platforms' own OIDC endpoints remain reachable, because the stealer runs with the workload's own identity.
AID-H-022.002
Pre-Merge Dependency Change Risk Review
High
A lock file only moves the decision to whoever updates it. JFrog observed dependency bots opening upgrade pull requests within six minutes of 1.26.1 reaching PyPI. Make a package-behavior and reputation check a required status on every pull request that changes a dependency, and treat a missing verdict as not passed. Endor Labs reports detecting the release within three minutes and SafeDep flagged it after 22; SafeDep also found a maintainer account on the project that had joined PyPI that same day, the kind of maintainer change this review is meant to surface. The gate keeps the bump from merging automatically. It does nothing for an install that never goes through a pull request.
AID-I-001.002
MicroVM & Low-Level Sandboxing
High
Run the steps that install and execute third-party AI dependencies inside a separately enforced VM, job container or OS sandbox that has its own process namespace and does not mount the developer home, the runner's credential files or cloud CLI caches. Apply the boundary before Python starts, because .pth code runs before any application import. The collector then cannot read other processes' environments through /proc, or files such as ~/.azure/*.json and .git-credentials. Secrets deliberately passed into that same runtime, and the identity it runs as, stay exposed.
AID-E-003.003
Confirmed Malicious Code & Persistence Eviction
High
After an affected environment is confirmed, remove the startup hook and the collector as named objects (agent_framework_meta.pth and agent_framework_meta/_telemetry.py for 1.26.1, af_runtime_diag.pth and af_runtime_diag.py for 1.26.2) or, better, rebuild the environment from a clean base. Do not find or delete them by starting the affected interpreter: pip, pytest and a Python inspection command all process the hook and run the stealer again. A check keyed only on the 1.26.1 file names misses 1.26.2. Afterwards, start each interpreter path once in a disposable copy that holds no credentials and has no network, and confirm that nothing malicious loads. A collector process that is already running has to be stopped separately. Quarantine on PyPI does not remove copies that were already downloaded. Evict both wheels by digest from internal mirrors, artifact proxies, pip and CI caches, and rebuild any container image that has either version baked into site-packages, so that no later build can install them again.
AID-E-001.001
Root & Long-Lived Credential Object Eviction
High
Treat every long-lived secret that was readable from an affected environment as exposed, and revoke and replace it at its issuer from a clean system: keys in environment variables and .env files (cloud, model-provider, registry), Git and package-registry credentials, Azure DevOps personal access tokens and service connection secrets, and the registration credentials of self-hosted runners. The collector keeps no record of what it read, so scope by what the host could reach, not by what a log shows. After rotation, present the old value and confirm that the issuer rejects it. The worked example in this guidance covers one AWS key class; every other issuer needs its own revoke-and-readback procedure.
AID-E-001.002
Issued Token, Authentication Session & Lease Revocation
Medium
Rotating a password or client secret does not end a session that was already issued. If ~/.azure/*.json token caches existed on an affected machine, revoke the sign-in sessions and refresh tokens of those accounts in Entra ID, then confirm that a cached refresh token no longer yields a new access token. This covers the sessions an identity provider can revoke. Access tokens that the collector obtained for a managed identity or through an OIDC exchange cannot be recalled this way; Wiz and JFrog put their lifetime at up to 24 hours.
AID-E-001.003
AI Agent & Workload Principal and Issuance Disablement
Medium
Tokens that the collector requests on the spot have no secret to rotate. Where an affected job could request GitHub Actions or Azure DevOps OIDC tokens, disable or tighten the federated credential or service connection that trusts that workflow until the environment is rebuilt. A captured OIDC token, or a job that still carries the hook, then cannot be exchanged for Azure access through that trust. For managed identities, recycle the affected compute, and narrow or remove role assignments if the logs show use from outside the workload. None of this recalls access tokens that were already issued.
AID-D-011.004
Non-Human Identity & Delegated Token Abuse Detection
Medium
Prevention is weak at this step because the collector asks for tokens as the workload itself. What stands out is the pattern: one identity requesting tokens for up to 12 resources in a single burst, including Graph, Key Vault, Storage and Azure DevOps, and possibly later use of those tokens from outside the workload. Send managed-identity and service-principal sign-in logs to the monitoring system, and alert when an identity requests a resource it was never approved for or when its token is used from an unexpected client. This detects the request or later misuse. It does not stop the token from being issued.
AID-H-023
Publisher Integrity & Workflow Hardening
Medium
This control belongs to the package publisher, not to consumers. Both wheels were built outside the project's release pipeline, and PyPI's record for the clean 1.26.0 files shows that they were not uploaded with Trusted Publishing and carry no provenance. Binding upload authority to a protected CI workflow through OIDC trusted publishing leaves no reusable publishing credential that works from another machine. The effect here is conditional. How the attacker obtained access is not confirmed (Wiz assesses a compromised client certificate and private key for Microsoft's internal release service), and every other account or credential that can still upload to the project has to be removed as well. The 2 minutes 23 seconds between the first quarantine and the second upload show why: taking a release down leaves publishing access in place.

What Defenders Should Do Now

  • Find out whether either version reached you, without starting Python. Search lock files, CI logs, internal mirrors and container images for agent-framework 1.26.1 or 1.26.2 and for the wheel SHA-256 digests d27fa34414e6201d5e03e559ef634f020057554d7b3f4898dd5d7cd3e989e110 (1.26.1) and 3d20a8bc91351a9a16b6db243b848ceca0206b7a8623b02d2af553a9c9f7e0a9 (1.26.2). On hosts and images, look in site-packages for agent_framework_meta.pth, agent_framework_meta/_telemetry.py, af_runtime_diag.pth and af_runtime_diag.py with file tools, not with pip or a Python command. If any is present, isolate the environment from the network and rebuild it from a clean base pinned to 1.26.0.
  • Check whether data left. Search proxy and DNS logs for webhook.site/d381fd80-ec62-42ad-8f5c-d1b15103c9bb and for the User-Agent values af-runtime-diagnostics/1 and runtime-diagnostics/1. Wiz reads an HTTP 200 as data accepted and a 410 or 429 as likely rejected; a connection to the domain alone proves neither.
  • Respond by credential type. Revoke and replace every long-lived secret the environment could read, and confirm at the issuer that the old value is refused. Revoke Entra ID sessions for accounts whose Azure CLI caches were on the machine. Managed identities and OIDC-federated pipelines have nothing to rotate: review their sign-in and activity logs from the install time onward, disable or tighten the federated credentials and service connections the affected jobs could use, and re-register self-hosted runners whose credential files were readable.
  • Close the install path. Lock the whole dependency tree with hashes and install only from that lock; in a test pipeline, an unpinned pip install agent-framework should fail or resolve only to the locked hash. Make a package-behavior check a required status on dependency-update pull requests, and confirm that a bump with no verdict cannot merge automatically.
  • Test outbound connections where Python actually runs. From a real CI runner or sandbox, send a request to a host that is not on the allowlist and confirm that it is blocked and logged. Where the job does not need the host's managed identity, confirm that 169.254.169.254 is unreachable from it.
  • If you publish packages yourself. Review who and what can upload to your registry project. Remove long-lived upload credentials and any account you cannot account for, and move publishing to a protected CI workflow with trusted publishing. When a release appears that you did not publish, revoke the credential that published it together with taking the release down.

2 additional considerations

Wait before adopting brand-new releases

Both malicious versions were quarantined within about 41 minutes of the first upload (20:35:20 to 21:16:44 UTC). A waiting period for newly published versions fits naturally into the update bot or resolver that consumer teams already run.
Recommendation: Set a minimum release age for dependency updates in the update bot (StepSecurity's check defaults to two days) and, where the installer supports it, at resolution time. A release that is withdrawn inside that window is never proposed. Urgent security updates are delayed too, so keep an exception path; an unpinned install outside the bot is not covered, and a version that ages past the window has not been shown to be safe.

Keep identity-token permission out of jobs that install and test dependencies

Version 1.26.2 could obtain GitHub Actions OIDC tokens only in jobs that had id-token: write, and exchanging one for Azure access also needs a federated credential that accepts that job's claims (StepSecurity).
Recommendation: Repository and pipeline owners can give id-token: write, service connections and mapped pipeline tokens only to the deployment job, run dependency installation and tests in a separate job without them, and scope each federated credential to a protected environment or branch. Malicious code in the test job then has nothing it can exchange for cloud access. A job that must install dependencies and deploy in the same step keeps the exposure.

Conclusion

The stealer needed three things from a consumer: an install that accepts a minutes-old version, a Python start in an environment full of secrets, and an open path to the internet. AIDEFEND  maps a defense to each: hash-locked dependency admission with a behavior review on every lock update, an isolated runtime for third-party packages, and outbound connections blocked by default where that runtime executes. For affected environments, its eviction techniques separate three kinds of identity material (long-lived secrets, issued sessions, and tokens requested on the spot), because each needs a different action at its issuer. The publisher's side stays open until Microsoft explains how the two releases were uploaded.

Last updated: