AI Agent Supply Chain Security: What One Hack Taught Us
A Microsoft Agent Framework PyPI package was hijacked to steal Azure and CI secrets. Here's the AI agent supply chain security checklist to use now.
By Babul Jack
How I'm thinking about AI agent supply chain security after the agent-framework hack
On November 17, 2026, someone pushed two malicious releases of Microsoft's own agent-framework package to PyPI and used them to steal Azure, GitHub Actions and CI credentials from anyone who installed it. AI agent supply chain security means treating every agent SDK, MCP server and skill package as a potential attack vector, pinning exact versions, and sandboxing install-capable agents so a hijacked package can't reach your real secrets. The incident is the clearest proof yet that this isn't theoretical.
I build agent systems for clients, and this one hit close to home because the compromised package wasn't some obscure typosquat — it was the real thing, published under Microsoft's own project. That changes the calculus for every team shipping agents in 2026.
What actually happened
Two unauthorized versions of agent-framework, 1.26.1 and 1.26.2, went live on PyPI on November 17, 2026 — 1.26.1 at 20:35 UTC and 1.26.2 at 21:08 UTC, about 30 minutes apart. Both were removed within the hour, after Elastic's supply-chain monitor flagged the first one just six minutes after it published, according to Elastic Security Labs' writeup.
The attack didn't need anyone to import the package. Both releases added a .pth startup hook — a plain-text file that Python's site module executes automatically every time the interpreter starts. A single line, import agent_framework_meta, ran a credential stealer on every Python process on the machine, whether or not agent_framework was ever used in code.
Environment variables containing strings like TOKEN, SECRET, PASSWORD, KEY, AZURE, AWS, GITHUB, HF_, OPENAI, NPM, PIP and CI_
Environment variables from up to 300 other running processes via /proc/[0-9]*/environ
Credential files: ~/.azure, .npmrc, .netrc, .git-credentials, .docker/config.json, Hugging Face tokens, and Azure DevOps agent .credentials
Fresh Azure managed-identity tokens pulled from the instance metadata service at 169.254.169.254
Azure DevOps OIDC tokens via SYSTEM_ACCESSTOKEN
In 1.26.2 only: GitHub Actions OIDC tokens, plus a higher captured-file limit
Everything was zlib-compressed, base64-encoded, and POSTed to a single webhook.site endpoint. Microsoft confirmed the incident on November 25, stating the malicious code lived only in the published package, not in the GitHub repository, and that 1.26.0 and earlier were not affected. The agent-framework meta-package averages roughly 196,000 downloads a month, per the stats Elastic cites, so the exposure window mattered even though it was caught fast.
Why this matters even if you don't use Microsoft's SDK
The lesson generalizes past one package. Agent frameworks, MCP servers and agent "skills" are now a dependency class attackers specifically target, because they often run with broad permissions — cloud credentials, API keys, CI tokens — and teams install them with the same casual trust they'd give a logging library.
Legitimate-publisher compromise, like this one, defeats the advice people usually give first ("only install from the real publisher"). The real publisher's account or pipeline was the thing that got hijacked. That's why the fix has to be structural: pinned versions, sandboxed execution and credential isolation, not just "check the package name."
Agent supply chain risk compared to a normal dependency
Factor
Typical library
Agent framework / MCP server
Runs on import or on install
Usually on import
Can trigger on install via .pth hooks, build scripts
Typical privileges
Scoped to app logic
Often has cloud credentials, API keys, shell/tool access
Blast radius if compromised
App-level
CI/CD, cloud subscription, every secret on the host
Update cadence
Can wait for review
Agent ecosystems ship fast, teams often auto-update
How do I pin and sandbox agent dependencies in practice?
These are the concrete steps I now put in client projects after this incident, roughly in priority order.
Pin exact versions, everywhere. Use pip install --require-hashes with a locked requirements file, or npm ci against a committed lockfile. Never let an agent host resolve to "latest" for a framework or MCP server package.
Add a cooldown window before adopting new releases. A few days is often enough for a live compromise like this one to be caught and pulled, the way PyPI removed both malicious versions within an hour.
Run install-capable agents with no persistent credentials. If an agent or CI job can install packages, it shouldn't also hold long-lived cloud tokens, SSH keys or .npmrc secrets in the same environment.
Sandbox execution. Ephemeral containers or microVMs with minimal egress mean a hijacked .pth hook has nowhere useful to send data and nothing valuable to read.
Inventory every agent component. List every agent SDK, MCP server, skill and model your teams and CI runners use. You can't pin or rotate what you haven't tracked.
Monitor registries for drift. Alert when a pinned package publishes a surprise new version, changes maintainers, or ships something that doesn't match its source repository tag.
Scope cloud identities tightly. Managed identities and OIDC federated credentials should be limited to the exact resource group they need, since this attack specifically targeted Azure IMDS tokens and Azure DevOps and GitHub Actions OIDC tokens to escalate from a stolen package into cloud access.
# Example: pin and verify a Python agent dependency with hashes
pip install --require-hashes -r requirements.lock.txt
# requirements.lock.txt (excerpt)
agent-framework==1.26.0 \
--hash=sha256:<the hash you verified, not "latest">
If you're building or maintaining agent pipelines for a team, this is exactly the kind of hardening work I do through AI agent development engagements — wiring up pinned dependencies, scoped credentials and sandboxed execution before an incident forces the issue.
What if I already installed 1.26.1 or 1.26.2?
Microsoft's guidance, confirmed in its repository update post, is blunt: treat the machine, container or CI job as fully compromised, not just the package.
Check site-packages for the indicator files: agent_framework_meta.pth and agent_framework_meta/_telemetry.py (1.26.1), or af_runtime_diag.pth and af_runtime_diag.py (1.26.2).
Rotate every credential that environment could reach — cloud identities, CI/CD tokens, package registry tokens, API keys, Git credentials. Don't just downgrade in place.
Rebuild from a clean image rather than patching live; remove cached copies in internal mirrors, artifact proxies and pip caches, since PyPI removing the package does not remove copies already downloaded.
Review cloud and CI audit logs from November 17, 2026 onward for activity you don't recognize.
If you never installed either version, pin to agent-framework==1.26.0 and hold there until Microsoft gives further guidance.
How does this connect to the rest of your agent security posture?
Supply chain security is one layer. It doesn't replace the others I've written about — agent-to-API authentication, prompt injection defenses or spending limits — it sits underneath them. A perfectly authenticated agent built on a hijacked package still leaks every credential it touches.
If you haven't already locked down how your agents authenticate to internal and external APIs, my AI agent authentication guide covers scoped tokens and short-lived credentials that limit exactly this kind of blast radius. If your agents rely on MCP servers, the MCP server security checklist is the companion piece — most of the CVEs there come from the same "we trusted the package" assumption this incident broke. And if your agents are exposed to untrusted input at all, it's worth re-reading how to secure AI agents from prompt injection, since a compromised dependency and a prompt-injected agent can combine into a much worse outcome than either alone.
Frequently asked questions
What is AI agent supply chain security?
It's the practice of treating every agent framework, MCP server, skill and model your team installs as a potential attack vector — pinning exact versions with hashes, isolating credentials from install-capable processes, and sandboxing execution so a compromised package can't reach real secrets or reach the broader network.
Was the Microsoft Agent Framework itself vulnerable, or just a package release?
Just the package release. Microsoft confirmed the malicious code existed only in the unauthorized PyPI uploads of versions 1.26.1 and 1.26.2, not in the GitHub source repository, and that the .NET packages and Semantic Kernel were unaffected. Version 1.26.0 and earlier remain safe.
How do I know if I installed a compromised version?
Search your site-packages directories for agent_framework_meta.pth and agent_framework_meta/_telemetry.py (1.26.1) or af_runtime_diag.pth and af_runtime_diag.py (1.26.2). Check pip freeze output, CI build logs, container images and internal package mirrors, since the window the packages were live covers any install or upgrade run without a version pin on November 17, 2026.
Can pinning versions fully prevent this kind of attack?
Pinning prevents you from silently picking up a malicious release the moment it's published, which is the most common path into this kind of incident. It doesn't protect you if you deliberately upgrade to a compromised version before it's caught, which is why a short cooldown window before adopting new releases is a useful second layer.
Does this affect npm packages and MCP servers too, or just PyPI?
The same pattern applies across registries. Malicious or hijacked releases have hit npm build tools, MCP server packages and other PyPI AI packages in the months before this incident, so the mitigations — pinning, sandboxing, credential isolation, registry monitoring — apply regardless of which package ecosystem your agent stack uses.
Key takeaways
On November 17, 2026, two unauthorized agent-framework releases (1.26.1, 1.26.2) on PyPI added a .pth-triggered credential stealer that ran on every Python startup, without needing the package to be imported.
The stealer targeted Azure CLI tokens, Azure managed-identity tokens via IMDS, Azure DevOps and GitHub Actions OIDC tokens, and credential files like .npmrc, .netrc and .git-credentials.
PyPI removed both versions within an hour, and Elastic's monitoring caught the first release within six minutes of publication.
Legitimate-publisher compromise defeats "only trust the real package" advice — pinning exact versions with hashes, sandboxing install-capable agents and scoping cloud credentials are the controls that actually hold.
If you installed either version, treat the whole environment as compromised and rotate credentials; rebuilding from a clean image beats downgrading in place.
Supply chain hardening is foundational — it has to sit under your agent authentication, prompt injection and spending-limit defenses, not replace them.