Frequently Asked Questions

Microsoft agent-framework PyPI Compromise: Incident Details & Lessons

What happened during the Microsoft agent-framework PyPI compromise in November 2026?

On November 17, 2026, versions 1.26.1 and 1.26.2 of agent-framework were published via the Microsoft-associated PyPI publisher account. Researchers described the event as an account compromise, not a typosquat. The second malicious version was published 33 minutes after the first, after PyPI had already quarantined 1.26.1. Each version dropped a .pth file into site-packages, causing the credential stealer to run every time Python started in that environment, including on pip, pytest, and IDE language servers. The payload harvested static secrets, read other processes’ environment variables, minted fresh tokens, and exfiltrated data to a webhook.site endpoint. There was no second stage or OS-level persistence; once files were removed, the stealer was gone, but credentials had already been sent out.

What is the main lesson from the agent-framework compromise, and how does Akeyless address it?

The core lesson is: if an AI agent can read a secret, so can any code running alongside it—including untrusted or malicious code. The attack did not exploit cloud vulnerabilities but harvested secrets already present in the environment, such as API keys, tokens, and identities. Akeyless advocates that AI agents should never have access to secrets at all. The Akeyless Identity Security Platform is designed to make this practical by removing secrets from agent environments and brokering access securely. With Akeyless SecretlessAI®, agents hold no API keys or tokens in environment variables, configuration files, or memory. Access is brokered via Dynamic Secrets and the Akeyless Gateway, so a stealer finds nothing to exfiltrate. Agentic Runtime Authority further ensures that every action is governed and audited, and credentials are short-lived and scoped to the minimum required permissions.

How did the credential stealer in the agent-framework package operate?

The malicious agent-framework package dropped a .pth file into site-packages, causing its payload to execute every time Python started. The stealer harvested environment variables matching patterns like TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, and OPENAI. It read up to 80 credential files (e.g., Azure CLI JSON, .npmrc, .netrc, Docker config, Hugging Face tokens), scanned up to 300 /proc/<pid>/environ entries, minted fresh tokens (GitHub Actions, Azure DevOps OIDC, Azure managed identity tokens), and exfiltrated all data to a webhook.site endpoint. There was no persistence; removing the files stopped the stealer, but any credentials it sent were already compromised.

What other recent credential theft and supply-chain incidents were mentioned alongside the agent-framework compromise?

Several related incidents were highlighted:

How does Akeyless SecretlessAI® protect against attacks like the agent-framework compromise?

Akeyless SecretlessAI® ensures that agents hold no API keys, tokens, or secrets in environment variables, configuration files, or memory. When an agent needs to access a system, Akeyless issues a Dynamic Secret—a short-lived credential with the minimum permissions required for the task. This credential is used inside a connection brokered by the Akeyless Gateway and is never exposed to the agent itself. Once the task completes or the credential's time-to-live expires, it is destroyed. As a result, a credential stealer scanning the agent's environment finds nothing to exfiltrate, preventing breaches like the agent-framework incident.

What steps should be taken if you installed a compromised version of agent-framework?

If you installed agent-framework versions 1.26.1 or 1.26.2, you should follow the response steps outlined in Chainguard’s analysis: isolate the affected host, remove the malicious files, rotate every credential that could have been accessed, and rebuild from a clean dependency set. Credential rotation closes this incident, but does not prevent future ones. The lasting fix is to change how agents access secrets—by removing secrets from agent environments and enforcing runtime controls, as described in the article.

Where can I read the full technical analysis of the agent-framework compromise?

You can read the detailed analysis in our blog post about the Microsoft Agent Framework PyPI compromise and in Chainguard’s analysis of the Microsoft Agent Framework compromise on PyPI.

Skip to content

The agent-framework PyPI Compromise: Why AI Agents Should Never Hold Secrets

Akeyless article cover reading “The agent-framework PyPI Compromise: Why AI Agents Should Never Hold Secrets” above multicolored light trails.

On November 17, 2026, two releases of Microsoft’s agent-framework package on PyPI shipped a credential stealer. The package is Microsoft’s SDK for building AI agents, and the payload was built for the places that SDK lives: CI runners, developer laptops, and production agent workloads.

The malware did not exploit a vulnerability in anyone’s cloud. It read what the agent’s environment already held: API keys in environment variables, tokens in dotfiles, and identities the host could mint on demand. That is the lesson worth acting on. If an AI agent can read a secret, so can every line of code that runs beside it, including code you never chose to trust.

This post walks through the attack, using Chainguard’s analysis as the technical reference, and sets it alongside other credential-theft campaigns from the past few weeks. It then makes one argument: AI agents should never have access to secrets at all, and the Akeyless Identity Security Platform is built to make that practical.

What Happened

Versions 1.26.1 and 1.26.2 of agent-framework were published through the Microsoft-associated PyPI publisher. Researchers describe it as an account compromise, not a typosquat. The second version went up 33 minutes after the first, after PyPI had already quarantined 1.26.1.

Each version drops a .pth file into site-packages. Python processes .pth files at interpreter start, so the stealer runs every time Python starts in that environment. It fires on pip, pytest, and IDE language servers, whether or not anything imports the package.

Once running, the payload does three things:

  • Harvests static secrets. It collects environment variables whose names match patterns such as TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, and OPENAI. It also reads up to 80 credential files: Azure CLI JSON, .npmrc, .netrc, pip.conf, Git credential stores, Docker config.json, Hugging Face tokens, and .env files.
  • Reads other processes. It scans up to 300 /proc/<pid>/environ entries, so secrets belonging to anything else on the host are in scope.
  • Mints fresh tokens. It requests GitHub Actions and Azure DevOps OIDC tokens, pulls Azure managed identity tokens for nine resource types (including Key Vault, Storage, Graph, and Container Registry), and queries the instance metadata service at 169.254.169.254.

Everything is compressed, encoded, and posted to a webhook.site endpoint. There is no second stage and no OS-level persistence. As Chainguard puts it, once the files are removed the stealer is gone, and the damage is the credentials already sent.

The Credential Theft Surge

The agent-framework compromise follows several similar credential-harvesting and supply-chain incidents over the past few weeks:

  • WPPConnect npm compromise (Nov 16, 2026). One day before the PyPI attack, malicious versions of the WPPConnect npm packages were published through the project’s trusted-publishing workflow. The payload swept environment variables, .env files, and active session tokens and sent them to a Telegram bot.
  • FBI alert on ARTEX credential chaining (Nov 13, 2026). The FBI warned that attackers are combining automated secret scanners with AI agents to find exposed credentials in repositories and CI/CD pipelines within seconds, escalating to cloud admin privileges in under three hours.
  • Exposed AI gateway campaigns (Nov 2026). Amazon threat researchers documented active campaigns scanning for exposed AI applications and model gateways, including LiteLLM and Dify, to harvest LLM provider keys and hijack cloud inference spend.
  • LiteLLM PyPI compromise (Oct 21, 2026). Less than a month earlier, the same Python .pth startup mechanism was used to backdoor LiteLLM releases on PyPI and container registries, exfiltrating cloud and AI keys from build runners and developer machines.

In all of these cases, the root vulnerability is an architecture that places long-lived credentials inside the runtime boundary of untrusted code.

Why Agents Are Targeted

Chainguard notes that the agent-framework payload does not spray for every credential type. It goes for Azure identities, OIDC tokens, and the local files where AI developers keep provider keys. Attackers are following the model access and the cloud spend.

That targeting works because of how agents are usually built. An agent needs to reach an LLM provider, a vector store, a database, a cloud account, and a handful of SaaS APIs. The common pattern is to hand it a static key for each one, loaded into environment variables or a .env file. The agent process becomes the densest collection of credentials in the environment.

Three properties of this incident show why that pattern cannot be defended:

  • The trust boundary is the whole process. A secret readable by the agent is readable by every dependency it loads. Here, a single transitive package was enough.
  • Provenance did not help. Both releases came from the legitimate publisher account. A trusted publisher is not a trusted release.
  • Detection is a race. A fast scanner blocked these versions in under a minute for its customers. Everyone installing directly from PyPI was exposed until quarantine, and 1.26.2 followed anyway.

Blocking malicious packages is necessary, and supply chain controls deserve investment. But the .pth technique has now worked twice in two months (LiteLLM in October, agent-framework in November). Planning for the next one means asking a different question: when hostile code runs inside the agent’s environment, what is there for it to take?

The only durable answer is nothing.

Agents That Hold Nothing Have Nothing to Steal

Most responses to incidents like this try to protect the secrets an agent holds: encrypt the .env file, rotate more often, tighten file permissions. None of that changes the outcome. The agent must be able to read the secret to use it, so the stealer running in the same environment can read it too.

Akeyless starts from a different premise: treat the agent as untrusted. It can be prompt-injected, it can hallucinate, and as this week showed, its dependencies can be replaced under it. Instead of securing the agent’s secrets, remove them. Three capabilities of the Akeyless Identity Security Platform work together to make that possible.

Akeyless SecretlessAI®

With Akeyless SecretlessAI®, the agent holds no API keys in environment variables, no tokens in configuration files, and no secret material in its working memory. Access still happens, on different terms:

  • When the agent needs to act on a target, the Akeyless platform creates a Dynamic Secret: a short-lived credential with the minimum permissions that one action requires.
  • The credential is used inside a connection brokered by the Akeyless Gateway. It is never shown to the agent.
  • It is destroyed on the target when the task completes or its time-to-live expires.

A stealer that scans the agent’s environment variables, dotfiles, and /proc entries finds no keys to the systems behind it, because none were ever placed there.

Agentic Runtime Authority

Removing stored keys is half the answer. This payload also minted fresh tokens from the host’s own identity, so the agent’s reach matters as much as its files. Agentic Runtime Authority addresses that:

  • Zero direct connectivity. The agent has no network path to corporate systems. Every request goes through the Akeyless AI Gateway, whether it arrives over MCP, native tool calling, a framework plugin, or an SDK call.
  • Rules defined in advance. The owners of each target system decide what each agent may do there. Each attempted action is evaluated against those rules before any credential is created. No match means the action is blocked at runtime.
  • In-session inspection and masking. Sensitive fields in responses, including stored secrets, are masked before they reach the agent’s context window.
  • A complete audit chain. Every action is recorded: request, evaluated intent, policy verdict, session, and the action on the target.

In this model, the identity of the agent’s host carries no standing roles on Key Vault, Storage, or production databases. Its only job is to prove to Akeyless who the workload is. A token minted from it opens none of those systems directly.

Akeyless Distributed Fragments Cryptography®

Moving credentials out of agents concentrates trust in the platform that issues them. Akeyless Distributed Fragments Cryptography® (DFC) is why that is safe. Encryption keys exist only as fragments in separate locations and are never combined. With a fragment held on the customer’s own Gateway, the result is Zero-Knowledge: not even Akeyless can access a customer’s secrets.

What a Thief Would Have Found with Akeyless

The same payload, run against a conventional agent deployment and against a secretless one.

What the thief targetedConventional agentWith Akeyless
Environment variables (OPENAI, AZURE, AWS, GITHUB, TOKEN, KEY)Long-lived provider and cloud keysNo target credentials present. Access is brokered by the Gateway.
Credential files (.env, Azure CLI JSON, .netrc, Docker config, Hugging Face tokens)Static secrets valid for monthsNothing written to disk for the agent to use
/proc/<pid>/environ of other processesSecrets of every neighbor on the hostWorkloads fetch Dynamic Secrets at runtime, with short TTLs and automatic revocation
Managed identity tokens (Key Vault, Storage, Graph, Container Registry)Direct access with the workload’s standing rolesHost identity has no standing roles on targets. It authenticates the workload to Akeyless only.
GitHub Actions and Azure DevOps OIDC tokensFederated sessions into the cloud accountPipelines exchange OIDC for scoped, short-lived Akeyless access bound by sub-claims
Use of stolen access after the factAttributed to a generic service accountEvery action checked against pre-defined rules and recorded in one audit chain

One caveat belongs here. Akeyless does not scan packages, and it would not have stopped agent-framework 1.26.1 from installing. Supply chain controls and secretless architecture solve different halves of the problem: one reduces how often hostile code gets in, the other determines what it can take. This incident is a case for running both.

What to Do Now

If you installed agent-framework 1.26.1 or 1.26.2, follow the response steps in Chainguard’s write-up: isolate the host, remove the payload, rotate every credential it could reach, and rebuild from a clean dependency set. Rotation closes this incident. It does nothing about the next one.

The lasting fix is a change in how your agents get access, and it has two parts that work together.

  • Take the secrets out of your agents with SecretlessAI. Stop giving agents keys. With SecretlessAI, the agent carries no API keys, tokens, or passwords in its environment, on disk, or in memory. When it needs to reach a system, Akeyless issues a just-in-time credential that lives only for that task and is never handed to the agent itself. For a stealer like this one, that changes the result from a breach to an empty search.
  • Enforce at runtime with Agentic Runtime Authority. While SecretlessAI based access answers the question “what can be stolen?” It does not answer “what can the agent be made to do?” An agent with no keys can still be manipulated into misusing access it is legitimately given, so Agentic Runtime Authority is the enforcement layer that closes that gap:
    • Checked before it happens. The agent’s request and its intent are evaluated against rules that system owners defined in advance. Only a match is allowed to proceed.
    • Out of policy is blocked at runtime. The decision is made before a credential is created and before the target system is touched.
    • Sessions stay supervised. Commands continue to be validated while the agent works, and sensitive data is masked before it reaches the agent.
    • When the task ends, so does access. Credentials are revoked automatically, and security teams can cut a session off at any moment.
    • Everything recorded. Each action is logged from request to outcome, so the question “what did the agent do, and under what authority?” always has an answer.

SecretlessAI without runtime enforcement leaves an agent that holds nothing but can still be steered. Runtime enforcement without SecretlessAI leaves keys sitting where the next poisoned package can read them. Together these solutions give you an agent with nothing to steal, nowhere to go on its own, and no action it can take unchecked.

Takeaways

The agent-framework compromise will not be the last attack aimed at the AI build chain. Agents sit where the model access, the cloud identities, and the data converge, and their dependency trees are large and fast-moving. Assume hostile code will run beside your agent again.

What you control is what it finds. An agent that holds secrets turns one poisoned package into a credential breach across every system the agent touches. An agent that holds nothing, reaches nothing directly, and acts only through a governed gateway turns the same event into a cleanup task.

AI agents should never have access to secrets. The Akeyless Identity Security Platform makes that the default: Akeyless SecretlessAI® removes credentials from the agent, Agentic Runtime Authority governs every action it takes, and Akeyless DFC keeps the keys beyond the reach of anyone but you.

See it in your environment. Request a Demo of SecretlessAI and Agentic Runtime Authority.

Related Resources

View all
Illustration of a secretless AI agent using Akeyless runtime authority
Blog How We Put Zero-Secret AI Agents to Work

Summary: Secretless access and runtime authorization are important concepts in AI agent security, but what do they look like in practice? At Akeyless, we…

November 15, 2026
  • G2 Fall 2026 Leader — Non-Human Identity Management
  • G2 Fall 2026 Momentum Leader — Privileged Access Management
  • G2 Fall 2026 High Performer — Certificate Lifecycle Management
  • G2 Fall 2026 Easiest To Do Business With — Secrets Management
  • G2 Fall 2026 Easiest To Use — Privileged Access Management, Enterprise
  • G2 Fall 2026 Best Support — Privileged Access Management, Enterprise