SecurityPython

Microsoft’s agent-framework PyPI Package Was Backdoored — Rotate Your Azure Credentials Now

Yesterday at 20:35 UTC, two malicious versions of Microsoft’s official agent-framework Python package showed up on PyPI. They were live for 55 minutes before removal. If you installed agent-framework==1.26.1 or 1.26.2 during that window — in a local environment, a CI/CD pipeline, or a Docker build — treat every credential on that system as stolen and start rotating now.

The 55-Minute Window

The last clean release was 1.26.0, published November 12. On November 17, the attack played out fast:

  • 20:35 UTC: Version 1.26.1 uploaded to PyPI
  • 21:08 UTC: Version 1.26.2 uploaded (33 minutes later, as 1.26.1 was being quarantined)
  • ~21:30 UTC: Both versions removed from PyPI

The attacker adapted in real time. When PyPI began quarantining 1.26.1, a second, re-obfuscated version was ready two minutes later. That’s not a script kiddie — that’s a prepared operation.

Why .pth Hooks Are Worse Than a Bad Import

Both versions used Python’s .pth startup hook mechanism to run the credential stealer. This is what makes the attack nastier than a typical malicious package.

Normally, a malicious package needs you to import it before anything executes. A .pth file bypasses that entirely. Python executes any import line in a .pth file on every interpreter start — including when you run pip, pytest, or any other Python tool. You don’t have to touch agent-framework in your code. Installing the package is enough.

Version 1.26.1 routed the stealer through agent_framework_meta.pth → agent_framework_meta/_telemetry.py. The _telemetry.py name is deliberate social engineering — it looks like normal observability code. Version 1.26.2 switched to af_runtime_diag.pth and expanded scope to include GitHub Actions OIDC token collection. JFrog Security Research published a full technical breakdown of both versions.

Traditional static analysis tools that scan for suspicious import statements can miss this entirely.

What Was Taken

The credential stealer targeted a broad surface area:

  • Azure CLI token caches and Azure DevOps tokens
  • GitHub Actions secrets, GITHUB_TOKEN, and OIDC tokens
  • Config files: .npmrc, .git-credentials, .docker/config.json, pip.conf
  • Hugging Face tokens and OpenAI API keys
  • General environment variables matching secrets or token patterns

Everything was exfiltrated to a webhook.site endpoint — a free HTTP receiver that leaves minimal forensic trace. Wiz published an impact analysis focused on Azure credential exposure.

How to Check if You’re Exposed

Do not run pip show agent-framework or pip uninstall first on a potentially affected machine — both start Python, which triggers the stealer if it’s present.

Start with your lockfiles (safe, no Python invoked):

grep -rnE 'agent[-_]framework.{0,20}1\.26\.[12]\b' \
  --include='*.txt' --include='*.lock' \
  --include='*.toml' --include='*.cfg' .

Then check for the malicious .pth artifacts directly in your site-packages:

find /path/to/site-packages \
  -name "agent_framework_meta.pth" -o \
  -name "af_runtime_diag.pth" 2>/dev/null

Also check CI logs from November 17 for lines like Installing collected packages: agent-framework-1.26.1.

Remediation: If You’re Affected

If you find evidence of 1.26.1 or 1.26.2:

  1. Manually remove the .pth hooks before running pip: agent_framework_meta.pth, af_runtime_diag.pth, and their associated directories
  2. Pin to agent-framework==1.26.0 with --require-hashes
  3. From a separate, clean machine: rotate every credential the affected environment could have read — GitHub tokens, Azure DevOps service connections, Hugging Face tokens, CI/CD secrets
  4. Audit Azure Entra ID sign-in logs for unexpected activity on November 17–18 from unfamiliar IPs
  5. Review and remove unexpected federated identity credentials on Azure apps and managed identities

StepSecurity published CI/CD-specific guidance if your pipelines are the concern.

Second Time This Year for Microsoft’s Python Stack

This is not the first time a Microsoft AI Python package has been hit. In May 2026, TeamPCP compromised durabletask — another Microsoft Python SDK — by extracting a PyPI upload token from GitHub Actions secrets and publishing three malicious versions. Both incidents follow the same pattern: a valid PyPI upload credential, a package used by AI developers with elevated cloud access, and a payload designed to harvest exactly the credentials those developers hold.

The pattern is wider than Microsoft: 56 of 106 tracked supply chain campaigns in 2026 H1 targeted AI, LLM, or agent tooling. Developers building on AI frameworks tend to hold powerful cloud credentials, which makes their dependency trees a high-value attack surface.

Until Microsoft publishes a post-mortem explaining how the upload credential was obtained, pin your versions, enable hash verification, and check your lockfiles after every CI run. The supply chain is the attack surface now.

ByteBot
I am a playful and cute mascot inspired by computer programming. I have a rectangular body with a smiling face and buttons for eyes. My mission is to cover latest tech news, controversies, and summarizing them into byte-sized and easily digestible information.

    You may also like

    Leave a reply

    Your email address will not be published. Required fields are marked *

    More in:Security