microsoft agent framework pypi supply chain attack

The Microsoft Agent Framework PyPI Supply Chain Attack: What Developers Need to Know

In November 2026, threat actors compromised Microsoft's agent-framework package on PyPI, the Python Package Index, injecting malicious code designed to steal cloud credentials. This attack demonstrates how even trusted open-source projects can become vehicles for credential theft if a single publishing account or build process is compromised. Understanding how this attack worked and what it means for your development environment is essential for anyone using Python dependencies in cloud-connected applications.

Microsoft Agent Framework PyPI Supply Chain Attack Explained

What Happened and When

On November 17, 2026, threat actors published two malicious versions of Microsoft's agent-framework package to PyPI: versions 1.26.1 and 1.26.2, released 33 minutes apart. Security vendors including Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity, and Wiz detected the compromise and coordinated to alert the community. The malicious code was engineered to execute a credential stealer every time Python started on an affected system, meaning any developer or production system with the compromised package installed would automatically run the theft routine on the next Python invocation.

This timing and method are typical of opportunistic supply chain attacks: the attacker gained access to the package publisher credentials or build pipeline, uploaded poisoned versions in rapid succession to avoid immediate detection, and relied on the automatic nature of pip updates to maximize infection. The 33-minute window between releases suggests either two separate attack attempts or an intentional staggered rollout to test detection response times.

How the Attack Worked

The compromised versions injected code into the package initialization sequence that would trigger credential harvesting from the host system. When Python imported the agent-framework module, the malicious payload would execute before any application code ran, giving it access to environment variables, local file systems, and credential storage mechanisms commonly used by cloud SDKs and development tools.

Cloud credentials are often stored in predictable locations: AWS credentials in `~/.aws/credentials`, Azure tokens in `~/.azure`, Google Cloud SDK tokens in `~/.config/gcloud`, and environment variables set by container orchestration tools or CI/CD systems. A credential stealer run at Python startup has a high success rate because it executes in the same process context as the application, with the same permissions and access to the developer's or container's credential stores.

The attack chain worked because PyPI does not enforce signed package uploads by default, and many developers do not verify package integrity or use lock files that pin exact versions. Any system that had pip configured to upgrade dependencies automatically or that used a loose version constraint (e.g., `agent-framework>=1.26`) would pull the malicious version on next install or update.

Why This Matters for Open-Source Users

This incident illustrates a critical vulnerability in the open-source ecosystem: the trust model of package managers assumes that the publisher's credentials and infrastructure are secure, but a single compromised account or stolen API token can poison thousands of downstream projects. Developers using agent-framework, whether directly or as a transitive dependency (a dependency of a dependency), would have executed the credential stealer without explicitly requesting that functionality.

For organizations using Python in cloud environments, the risk is compounded because cloud credentials are often the highest-value target. Once stolen, credentials can be used to access databases, object storage, API keys for other services, and sensitive configuration. Unlike a worm that damages systems visibly, credential theft is silent: the attacker exfiltrates access and disappears, leaving no obvious trace until unauthorized activity occurs days or weeks later.

The coordinated disclosure by eight major security firms suggests this attack was caught relatively quickly, but not before some installations occurred. The exact number of affected systems and whether credentials were actually exfiltrated has not been publicly disclosed in full detail.

Reality Layer: How Supply Chain Attacks Persist

Threat actors focus on high-reach packages with security-adjacent functionality. The agent-framework package, because it is associated with Microsoft and likely used in cloud automation and development tools, had both credibility and distribution breadth. According to security-vendor incident reports on similar attacks, compromised packages in the infrastructure, DevOps, and cloud SDK categories see the highest downstream infection rates because they are trusted and installed in privileged contexts like CI/CD systems and production deployments. This matters to you because a popular package in your dependency tree is a higher-value target than an obscure one.

PyPI has limited enforcement of code signing and verification at install time. The Python Package Index itself does not mandate that packages be cryptographically signed, and pip does not verify signatures by default. This contrasts with some other package managers and means that trust in PyPI package integrity relies on account security, audit logs, and post-publication detection by the community rather than technical prevention. If you use Python, this means you cannot rely on the package manager alone to catch tampering.

Credential stealing is the most common payload in these attacks because stolen credentials provide persistent access and are easy to monetize. According to court records and law-enforcement statements on compromised infrastructure, attackers who steal cloud credentials often sell them to other threat actors or use them for lateral movement into corporate networks. The reason is simple: credentials are reusable, leave minimal traces if used carefully, and unlock vastly more attack surface than any single malware family can exploit.

Detection by multiple vendors in real time indicates that package security monitoring has matured but is not universal. Aikido, Chainguard, Endor Labs, Socket, and others maintain databases of malicious or suspicious package behavior. This coordinated detection and disclosure is a positive development, but it also means that malicious packages will be uploaded and discovered in a cat-and-mouse cycle. Organizations without threat intelligence subscriptions may not know about a compromised package until it is widely reported in security news.

What You Should Do Right Now

If you use Python and install packages from PyPI, take these steps to assess and reduce your risk:

  1. Check your current installed packages for agent-framework using `pip freeze | grep agent-framework` or `pip list` and note the version number.
  2. Review your `requirements.txt`, `setup.py`, or `pyproject.toml` files to see if agent-framework is listed as a direct dependency or if you are unsure whether it is installed transitively.
  3. If you have versions 1.26.1 or 1.26.2 installed, immediately remove them and upgrade to a patched version once Microsoft or the maintainers issue a fixed release.
  4. For production systems, do not use `pip install -U` or loose version constraints like `>=1.26` without specifying an upper bound; instead, use lock files generated by `pip freeze`, `poetry.lock`, or `pipenv.lock` that pin exact versions.
  5. Consider using tools like `pip-audit`, Socket, or Snyk to scan your dependencies for known malicious packages and vulnerabilities before deployment.
  6. Check your cloud credential logs and access activity for any unauthorized API calls or session activity starting from November 17, 2026. If you suspect credentials were stolen, rotate cloud API keys, access tokens, and temporary credentials as a precaution.

Protecting Your Development Workflow

This attack reveals weaknesses in how most teams consume open-source code. Treating every pip install as safe because the package came from the official PyPI index is no longer justified. A more defensive posture involves several layers:

Use dependency lock files that pin exact versions and are version-controlled so that all team members and CI/CD systems install the same package versions. This prevents accidental upgrades and makes it easier to trace which versions were in use when.

Enable package integrity verification by using hash-checking mode in pip (`pip install --require-hashes`) or by using tools like `pip-tools` or Poetry that generate and verify package hashes automatically.

Monitor for malicious packages in real time by integrating a threat intelligence feed or scanning tool into your development pipeline. Some open-source tools flag packages known to contain malware before they are installed.

Limit credential exposure in development environments by using temporary, scoped credentials from your cloud provider's SDK instead of storing long-lived keys in files or environment variables. For example, use AWS STS `AssumeRole` tokens that expire after one hour rather than permanent IAM user keys.

Key Takeaway and Next Steps

The Microsoft agent-framework compromise shows that no source code repository, build system, or package index is immune to compromise if the human or technical link in the chain fails. Blindly trusting a package manager without verifying package integrity, monitoring for malicious behavior, and controlling version updates is a critical operational weakness that attackers actively exploit.

Your immediate action should be to audit your Python dependencies, verify that you are not running the compromised versions, and implement one defensive measure from the list above. Even if you are not affected by this specific attack, the same techniques will catch the next one.

Frequently Asked Questions

How do I know if I installed the malicious agent-framework versions?

Run `pip show agent-framework` to check the version number. If it shows 1.26.1 or 1.26.2, you have an affected version. You can also use `pip freeze > current_packages.txt` to export all installed packages and check against security vendor reports that list the exact version numbers and checksums of the malicious packages.

Can I just delete the malicious package and reinstall a clean version?

Yes, but you must assume that any credentials stored or accessible to Python at the time of installation may have been stolen. First, upgrade or downgrade to a confirmed safe version by running `pip install --upgrade agent-framework==<safe_version_number>` after Microsoft or the maintainers release a patched version. Then, rotate your cloud credentials as a precaution, even if there is no evidence they were accessed.

Why does PyPI allow unsigned packages if security is important?

PyPI does not require package signing because it adds friction to the publishing process and the ecosystem prioritized ease of use over mandatory verification. Recent efforts like PEP 740 are moving toward optional signing, but adoption is slow. For now, the burden of verification falls on the user and on security scanning tools.

Do I need to use a VPN or Tor to download packages safely from PyPI?

No. Anonymity is not the issue here; the malicious code was in the package itself, not injected by a network eavesdropper. The attack worked because the attacker uploaded code directly to PyPI, not because of transport layer weakness. Using HTTPS (which pip does by default) protects against network interception, but does not protect against malicious code published by a compromised account.

Source: The Hacker News