MAI Code 2 on Stage, .pth Credential Theft on PyPI: The Microsoft Agent Framework Breach
While Microsoft executives took the Ignite stage in San Francisco to pitch their in-house MAI Code 2 models as cheaper and safer alternatives to OpenAI and Anthropic, attackers hijacked Microsoft's official open-source P
While Microsoft executives took the Ignite stage in San Francisco to pitch their in-house MAI Code 2 models as cheaper and safer alternatives to OpenAI and Anthropic, attackers hijacked Microsoft's official open-source Python package agent-framework on PyPI (~190,000 monthly downloads). Published 33 minutes apart on November 17, 2026, versions 1.26.1 and 1.26.2 silently drained cloud credentials from developer laptops and CI/CD runners. On the very same news cycle, reverse-engineering revealed Windows 11's MissionControlAggregator.dll quietly cataloging rival local coding agents. Microsoft was counting which agent you launched at the OS layer while losing control of its own agent package on PyPI.
The attack mechanics expose a brutal risk arbitrage: the payload never waits for an import agent_framework statement. Both malicious wheels drop .pth startup hooks directly into site-packagesβagent_framework_meta.pth in 1.26.1 and af_runtime_diag.pth in 1.26.2. Because Python executes import lines inside .pth files on every interpreter initialization, invoking python, pytest, or even pip itself triggers the stealer in 0 ms. Meanwhile, the package still pulls the legitimate agent-framework-core dependency so your application keeps running without a single traceback.
It is the software equivalent of installing a biometric vault door while leaving the master key taped to the utility meter outside. Engineering teams spend weeks debating prompt-injection guardrails while leaving the underlying Python dependency layer completely unguarded.
Worse, the stealer goes far beyond static files on disk (~/.azure/*.json, .npmrc, pip.conf, .netrc, .git-credentials, .docker/config.json, Hugging Face, and .env secrets). It actively mints fresh cloud identities at runtime: querying Azure's Instance Metadata Service (169.254.169.254), IDENTITY_ENDPOINT, and MSI_ENDPOINT for Managed Identity tokens, using SYSTEM_ACCESSTOKEN and SYSTEM_OIDCREQUESTURI in Azure DevOps to request federated api://AzureADTokenExchange tokens, and harvesting GitHub Actions OIDC tokens in 1.26.2. Everything is packed into JSON, zlib-compressed, Base64-encoded, and sent via HTTPS POST to a hardcoded webhook.site endpoint. Simply rotating static secrets on disk does not invalidate tokens minted on the fly.
The root architectural flaw is clear: AI agent stacks hand full cloud and repository privileges to developer environments and CI runners while leaving site-packages flat and unverified. Without strict hash pinning (--require-hashes), isolated execution sandboxes, and outbound network egress allowlists, one pip install compromises the entire cloud perimeter.
Trillion-dollar vendors love selling autonomous agent security from keynote stages while failing to lock down their own publishing pipelines. If your agent runners lack strict egress filtering and cryptographic dependency pinning, you are not running an AI platformβyou are operating an unguarded ATM :)
Originally published on KΓΌrΕat YΔ±lmaz Technical Blog
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.