PyPI package compromise credential stealer

How Attackers Compromised Microsoft's Agent Framework Package on PyPI

A widely used Python package trusted by Microsoft developers became a delivery mechanism for credential-stealing malware when threat actors compromised it on PyPI, the official Python package repository. Malicious versions 1.26.1 and 1.26.2 of agent-framework were released 33 minutes apart on November 17, 2026, each designed to run a credential stealer every time Python started on an infected machine. This incident exposes a real vulnerability in how open-source dependencies can be weaponized against cloud environments.

Microsoft Agent Framework PyPI Compromise: Credential Stealer Attack

What Happened: Timeline and Scope

On November 17, 2026, two malicious versions of Microsoft's agent-framework package appeared on PyPI within 33 minutes of each other. Multiple security vendors, including Aikido, Chainguard, Endor Labs, OX Security, SafeDep, Socket, StepSecurity and Wiz, detected and documented the compromise independently. The malicious code was designed to execute a credential stealer on every Python interpreter start, meaning it would run silently in the background of any system where an affected version was installed.

PyPI is the primary repository for Python packages, used by millions of developers worldwide. Because agent-framework is published under Microsoft's namespace and carries implicit trust, developers installing the package would have had no obvious way to distinguish the malicious version from a legitimate release without inspecting the source code or consulting security alerts in real time.

How Supply-Chain Attacks Work Through Package Repositories

Package repositories like PyPI are high-value targets because they sit at a critical choke point in software development. When a package is compromised at the source, the malware reaches every downstream consumer automatically, often without triggering manual code review. The attack typically unfolds in three stages: first, the attacker gains access to the repository account through credential theft, social engineering, or account compromise; second, they upload a poisoned version with a minor version bump that appears legitimate; third, developers using automated dependency updates or manual installations pull the malicious code into their projects.

The speed of the November 17 releases (33 minutes apart) suggests the attacker had already gained access and was moving quickly to maximize the window before detection. Security vendors detected it only because they monitor PyPI feeds for suspicious changes and run automated analysis on newly published packages. Without this infrastructure, the malware could have spread for days or weeks.

The Credential Stealer: How It Worked

The malicious versions of agent-framework embedded code designed to run at Python startup, which means it would execute silently every time a Python script or application launched on an infected system. Startup-time execution is a favored technique because it is difficult to notice and persists across reboots and applications. In this case, the payload targeted cloud credentials, specifically those stored in environment variables or configuration files commonly used by Azure, AWS and GCP SDKs.

Cloud credentials are high-value targets because they grant direct access to cloud resources, data and sensitive infrastructure. An attacker who steals these credentials can authenticate as the compromised developer or service account, access source code repositories, production databases, backup systems and other assets without triggering traditional authentication alerts. This makes credential theft from developer machines particularly dangerous because it bypasses multi-factor authentication and organizational security policies that might protect direct cloud login attempts.

Why This Attack Matters: Real-world Impact

Developers and companies face an uncomfortable truth: they cannot manually inspect the code of every dependency they use. Python projects routinely depend on hundreds or thousands of transitive packages. A single compromised package can therefore affect thousands of downstream projects simultaneously. In this case, anyone running agent-framework versions 1.26.1 or 1.26.2 was at immediate risk of credential exposure.

The attack highlights a tension between convenience and security in open-source development. Automatic dependency updates, which are recommended for security reasons, can inadvertently pull in malicious code if a repository account is compromised. Manual version pinning, on the other hand, can leave developers exposed to known vulnerabilities. There is no perfect solution, only trade-offs.

How to Protect Against Supply-Chain Package Attacks

If you use Python and install packages from PyPI, consider the following protective measures:

  1. Monitor security alerts from vendors that scan PyPI (Socket, Wiz, Endor Labs and others publish regular advisories on compromised packages)
  2. Review your dependency list periodically and remove packages you are no longer using
  3. Pin dependency versions explicitly in your requirements files or lock files, rather than accepting any minor version update automatically
  4. Use a software composition analysis (SCA) tool in your build pipeline to detect known-vulnerable or malicious packages before deployment
  5. Rotate cloud credentials regularly, especially for developer machines and CI/CD environments
  6. Use short-lived, scoped credentials instead of long-lived API keys where possible
  7. Monitor cloud account activity for unexpected resource access or API calls from unusual IP addresses
  8. Assume that if a package repository is compromised, you may have been affected; audit your systems proactively rather than waiting for a detection alert

Lessons for Organizations and Developers

This incident is not the first supply-chain attack on open-source repositories, nor will it be the last. The npm ecosystem, which serves JavaScript packages, has experienced dozens of similar compromises. The root cause is structural: maintainers often have a single point of failure in their account credentials, and attackers prioritize high-trust packages that affect large numbers of downstream users.

Organizations should treat their dependency list as part of their threat surface. A strong response includes maintaining a Software Bill of Materials (SBOM), implementing automated dependency scanning, and establishing incident response procedures specifically for supplier compromises. Developers should assume that any public package repository may be compromised at some point and design their systems to limit the damage if credentials or code are stolen.

FAQ

What should I do if I installed agent-framework versions 1.26.1 or 1.26.2?

Immediately upgrade to a patched version (check the official Microsoft repository for confirmation of a safe version number), rotate any cloud credentials that may have been exposed, and audit your cloud account activity for unauthorized access. If you store credentials in environment variables, assume they were stolen.

How do I know if a package on PyPI is safe?

No single check guarantees safety, but you can check the package's download history (sudden spikes are suspicious), read recent issue reports on the official repository, verify that the package is listed on the official maintainer's website, and use automated security tools that scan PyPI feeds. Always prefer official repositories and verified maintainers.

Can I get malware just by running pip install?

Yes. A malicious package can execute arbitrary code during installation and at runtime. This is by design in Python and is unavoidable when using untrusted packages; it is why pinning versions and using dependency scanning are important.

Is Tor or a VPN involved in PyPI package attacks?

No. The attack is not about anonymity; the attacker uploaded the malicious code directly to PyPI using a compromised or stolen account. The malware payload itself targets cloud credentials, which are stored on the developer's local machine or in their cloud environment, not on Tor or anonymous networks.

Source: The Hacker News