Subscribe
AI
2 min read

Microsoft's Agent Framework PyPI Package Hijacked to Steal Cloud Credentials

Attackers compromised Microsoft's official agent-framework package on PyPI and published two malicious versions designed to quietly harvest cloud credentials, BleepingComputer reported. The rogue releases, versions 1.26.1 and 1.26.2, went live on November 17 and hit one of the more popular toolkits for building AI agents in Python, with roughly 200,000 monthly downloads. A stealer that runs before your code does The payload's persistence mechanism is the notable part. Both wheels drop a .pth

Microsoft's Agent Framework PyPI Package Hijacked to Steal Cloud Credentials

Attackers compromised Microsoft's official agent-framework package on PyPI and published two malicious versions designed to quietly harvest cloud credentials, BleepingComputer reported. The rogue releases, versions 1.26.1 and 1.26.2, went live on November 17 and hit one of the more popular toolkits for building AI agents in Python, with roughly 200,000 monthly downloads.

PyPI supply chain illustration

A stealer that runs before your code does

The payload's persistence mechanism is the notable part. Both wheels drop a .pth file into site-packages (agent_framework_meta.pth in 1.26.1, af_runtime_diag.pth in 1.26.2, per Endor Labs analysis). Python executes import lines in .pth files every time any interpreter starts, so the stealer runs on any Python launch in an affected environment, including pip itself, whether or not anything ever imports Agent Framework.

Once running, the malware collects secrets three ways, according to analyses by Socket, SafeDep and OX Security:

  • Environment variables, matched on substrings such as TOKEN, SECRET, KEY, AZURE, AWS, GITHUB, OPENAI, HF_ and TENANT. Version 1.26.2 adds ACTIONS, OIDC, RUNNER and ARM_ patterns.
  • Other processes' environments via /proc, filtering for tokens, passwords and CI identity headers.
  • Credential files on disk: .npmrc, pip.conf, .netrc, .git-credentials, .docker/config.json, Hugging Face tokens, Azure DevOps agent credential paths, and .env and JSON files.

It also asks the platforms to mint new credentials rather than only copying existing ones, requesting Azure managed identity tokens and Azure DevOps OIDC tokens across audiences that include Key Vault, Storage, Microsoft Graph and Container Registry. SafeDep's point is the uncomfortable one: rotating stored secrets does not cover tokens the malware gets the cloud to issue fresh.

Collected data was exfiltrated over outbound HTTPS to a webhook.site endpoint as zlib-compressed, base64-encoded JSON, per Socket and OX Security. Targeted services span Azure, AWS, GitHub, Docker, Hugging Face and OpenAI credentials, so an infected developer laptop or CI runner can surrender identities well beyond Microsoft's stack.

What to do

BleepingComputer reports it is unclear how the attacker gained publishing access to Microsoft's official PyPI project, and that Microsoft had not responded to its inquiry by publication. Developers who installed 1.26.1 or 1.26.2 should isolate affected environments, avoid running Python or pip until the environment is secured, and rebuild from a known-clean base using the safe release. Treat every credential the machine could reach, including cloud-issued tokens, as exposed.

The incident continues a 2026 pattern of supply-chain attacks aimed at AI developer tooling, where packages move fast, download counts are high, and the credentials inside a developer environment are the whole prize. If you run agent-framework in CI, the blast radius is your pipeline, not just your laptop.

Sources

AISecurityOpen Source