Back to Blog
    Breach AnalysisSupply chain · Agent Principal compromise

    Microsoft Agent Framework on PyPI Hijacked: A Credential Stealer Inside the Tool That Builds AI Agents

    8 min readAndeavour Research
    123✓5ATTACK CHAINBroken by AgentGuard
    Illustration: Microsoft Agent Framework on PyPI Hijacked: A Credential Stealer Inside the Tool That Builds AI Agents
    33 min
    between the two malicious agent-framework releases pushed to PyPI on November 17, 2026

    Key takeaways

    • →Attackers published agent-framework 1.26.1 and 1.26.2, the meta-package for Microsoft Agent Framework, to PyPI on November 17, 2026. Both are now quarantined.
    • →Each release dropped a .pth file into site-packages, so the stealer ran on every Python start, including pip itself, and sent credentials, environment data and cloud identity tokens to a webhook.site endpoint.
    • →The machines that build agents are AI Principals. AgentGuard inventories them, binds agent identities to their Principal and blocks agents and tokens from acting outside their declared purpose, so stolen keys can't be quietly turned into agent actions.
    Attack chain, and where it breaks
    1. 1

      Attacker gains publish access to agent-framework on PyPI

    2. 2

      Versions 1.26.1 and 1.26.2 published 33 minutes apart

    3. 3

      .pth startup hook runs on every Python launch

    4. 4

      Stealer collects env secrets and cloud identity tokens

      AgentGuard flags the Principal's anomalous token use and blocks agent identities from acting outside their purpose

    5. 5

      Data sent to a webhook.site endpoint

    Affected
    Developers and CI pipelines that installed agent-framework 1.26.1 or 1.26.2
    When
    Published November 17, 2026 · reported November 18, 2026
    Impact
    Theft of credentials, environment variables and cloud identity tokens from agent-building environments

    What happened

    Microsoft Agent Framework is an open-source Python framework for building and orchestrating AI agents. Its meta-package on PyPI is called agent-framework. On November 17, 2026, an attacker published two malicious versions, 1.26.1 and 1.26.2, 33 minutes apart. Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity and Wiz all reported it, and PyPI quarantined both versions. How the attacker got publishing access is still unclear.

    The trick was a .pth file. Python reads .pth files in site-packages on every interpreter start and executes any import lines inside them. Version 1.26.1 dropped agent_framework_meta.pth and 1.26.2 dropped af_runtime_diag.pth. As Endor Labs put it, the stealer ran on any Python launch in an affected environment, including pip itself, whether or not anything imported Agent Framework.

    According to Socket, the hooks silently collected credentials, environment data and cloud identity tokens, then sent them to a webhook.site endpoint.

    Why this is an AI Principal breach

    A developer laptop or CI runner that builds agents is not an ordinary workstation. It holds the model provider keys, the cloud identities the agents will run as, and the deployment tokens that push new agents to production. In Andeavour's terms it is a Creator Principal. Compromise it and every agent it creates inherits the attacker's access.

    • No import needed: the .pth hook fires on any Python start
    • Signed, official package name: dependency allow-lists passed it
    • Targets exactly the secrets agents use: LLM keys and cloud tokens
    • CI runners often hold broader rights than any single developer

    How AgentGuard would have contained it

    AgentGuard can't stop a poisoned package from being downloaded; that's the job of your package controls. What it does is make the stolen material far less useful, and make its misuse visible fast.

    First, Principal inventory. AgentGuard knows which machines, pipelines and accounts create, train and command your agents, and which identities and keys each agent was issued. When an agent's token or a Principal's cloud identity is used from a new place or for a new purpose, that's a high-fidelity signal, not noise.

    Second, purpose binding. Every agent identity is tied to its declared task. A stolen agent key that suddenly lists storage buckets, reads secrets or creates new agents is blocked at the action layer, because no registered agent's purpose includes it.

    Third, fast blast-radius answers. When the advisory drops, AgentGuard shows which agents were built or deployed from affected environments, so you rotate the right keys first instead of all of them blindly.

    What to do Monday

    If you installed agent-framework on or after November 17, treat the environment as compromised.

    • Search lockfiles and images for agent-framework 1.26.1 or 1.26.2
    • Look for agent_framework_meta.pth or af_runtime_diag.pth in site-packages
    • Rotate LLM provider keys, cloud credentials and CI tokens from affected hosts
    • Pin agent dependencies by hash and inventory every agent-building Principal

    The lesson

    Each of these incidents turned an AI agent, or the tooling around it, into the attacker's best employee: legitimate credentials, legitimate permissions, machine speed. Patching the one flaw doesn't change that. AgentGuard governs what every agent and its Principal is allowed to do, wherever it runs, with zero integration and deployment measured in days.

    Frequently asked questions

    Which agent-framework versions were malicious?

    Versions 1.26.1 and 1.26.2 of Microsoft's agent-framework package on PyPI, published 33 minutes apart on November 17, 2026. Both have been quarantined.

    How did the agent-framework stealer run without being imported?

    Each version added a .pth file to site-packages. Python executes import lines in .pth files on every interpreter start, so the stealer ran whenever Python launched in that environment.

    How does AgentGuard help after an AI supply chain compromise?

    AgentGuard inventories the Principals that build and command agents, binds each agent identity to its purpose and blocks out-of-purpose actions, so stolen agent keys and tokens can't be quietly abused, and it shows which agents are affected.

    See AgentGuard on your own environment

    Zero integration. Live in days. We'll show you what your current stack is missing.