Skip to the content
AI and Cybersecurity Learning and Practice Center Test automation Open the Learning Center

IncidentSupply chain

Microsoft's agent-framework package on PyPI: versions 1.26.1 and 1.26.2 carried a credential stealer that runs on every Python start

CriticalMicrosoftStepSecuritySocketOX Security

On November 17, 2026 two releases of agent-framework, Microsoft's official Python package for building AI agents, were published to PyPI with a credential-stealing payload, StepSecurity, Socket and OX Security report. StepSecurity's timeline has 1.26.1 uploaded at 20:35 UTC and quarantined by PyPI at 21:06, then 1.26.2 uploaded two minutes later, at 21:08, and quarantined at 21:16, so quarantining one release did not stop the next upload. The last clean release is 1.26.0, from November 12. Both bad releases kept depending on the genuine agent-framework-core 1.26.0, so the framework still worked. The payload is a .pth startup hook, which runs whenever Python starts in that environment, with no import of the framework needed; in 1.26.2 the attacker restored the package's original initializer and moved the hook to a new file, af_runtime_diag.pth, so checking that file alone misses it. It collects host details, environment variables whose names contain words such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI and HF_, the environments of up to 300 other processes, and credential files for Azure CLI, pip, npm, Git, Docker, Hugging Face and Azure DevOps agents plus .env files. It also asks for fresh tokens from Azure managed identity and Azure DevOps OIDC, and 1.26.2 adds GitHub Actions OIDC; StepSecurity stresses these are attempts, with no confirmation any token was issued. Everything is compressed, encoded and sent in one request to a webhook.site address. StepSecurity says the evidence does not show how the attacker got publishing rights. OX counts 192,534 monthly downloads of the package. No CVE has been assigned and none of the reports includes a Microsoft statement; BleepingComputer says Microsoft had not answered its question about how the project was breached.

Replay the attack step by step in the Learning Center

How it happened

  1. Someone with publishing rights to the official agent-framework project uploaded two releases with an added .pth file; how they got those rights is not established.
  2. Python runs .pth files at startup, so the stealer ran in any process in that environment, whether or not it imported the framework.
  3. It gathered secrets from the environment, other processes and credential files, requested cloud and CI identity tokens, and posted the lot to a webhook.site endpoint.

Impact

Any machine or CI runner that installed 1.26.1 or 1.26.2 during the roughly 40 minutes they were available should treat every secret it could reach as exposed, including identity tokens that may have been issued to the attacker.

The fix

StepSecurity advises isolating affected hosts and runners before running Python or pip again, rebuilding from a clean base, rotating every credential the payload could read or request, reviewing GitHub OIDC permissions, Azure federated credentials, Azure DevOps service connections and managed-identity role assignments, because rotating stored secrets does not cancel tokens already issued, searching egress logs for webhook.site, and pinning agent-framework to 1.26.0 with hashed lock files. OX advises treating every secret reachable from the host as compromised; Socket advises removing both versions and rotating credentials.

Lessons

  • An official vendor package is only as safe as its publishing accounts; pin versions with hashes and let new releases age before they reach CI.
  • A .pth file turns an install into code that runs on every Python start, so review what a package adds to site-packages, not only its main module.
  • Short-lived, narrowly scoped CI identities limit what a stealer can take in the minutes it has.

Sources