Microsoft 'agent-framework' PyPI Package Compromised in Supply Chain Attack

Microsoft's 'agent-framework' PyPI Package Hijacked to Steal Credentials

CRITICAL
November 19, 2026
6m read
Supply Chain AttackMalwareCloud Security

Related Entities

Organizations

Products & Tech

Other

GitHub Hugging Face

Full Report

Executive Summary

On November 17, 2026, Microsoft's official 'agent-framework' package on the Python Package Index (PyPI) was compromised in a sophisticated supply chain attack. Threat actors published two malicious versions, 1.26.1 and 1.26.2, which included a potent credential-stealing malware. The malware was designed to automatically execute upon Python interpreter startup and harvest a wide array of secrets from developer workstations and CI/CD environments, including credentials for Azure, AWS, GitHub, and more. The affected package, which is downloaded around 190,000 times per month, posed a significant risk to cloud and development infrastructure. The malicious versions were quickly removed from PyPI, but any user who installed them is considered compromised and must take immediate remediation steps.


Threat Overview

This attack represents a classic example of software supply chain compromise, targeting a trusted, popular open-source package to distribute malware. The attackers managed to gain publishing rights to the official Microsoft 'agent-framework' project on PyPI, a toolkit for building AI applications.

The malicious payload was embedded within versions 1.26.1 and 1.26.2, which were live for only 33 minutes before being quarantined. The malware's activation mechanism was particularly insidious: it used a .pth file, a legitimate Python feature that allows code to be executed at interpreter startup. This means the malware ran automatically in any environment where the compromised package was installed, without needing to be explicitly imported into a project. To further evade detection, the malicious versions included the original, legitimate 'agent-framework' code, ensuring that developer applications would continue to function normally.


Technical Analysis

The core of the attack was the credential-stealing payload. It was designed to be comprehensive, targeting a wide range of sensitive information commonly found in developer and CI/CD environments.

Targeted Credentials:

  • Environment Variables: Scanned for secrets related to Azure, AWS, and GitHub.
  • Configuration Files: Parsed ~/.docker/config.json, ~/.npmrc, and Hugging Face config files for authentication tokens.
  • Dynamic Token Theft: Actively attempted to generate and steal new tokens, including:
    • Azure managed identity tokens
    • Azure DevOps OIDC tokens
    • GitHub Actions OIDC tokens

This broad targeting indicates a clear intent to gain deep and persistent access to cloud infrastructure and software development pipelines. By stealing OIDC tokens, attackers could potentially impersonate CI/CD workflows to access production environments or poison other software artifacts. The method by which the attackers gained publishing access to the PyPI project is currently unknown but could involve compromised developer credentials or a flaw in the PyPI platform's account recovery process.

Analyst-Assessed MITRE ATT&CK Techniques


Impact Assessment

The potential impact of this breach is severe. Developers and CI/CD systems that installed the malicious versions would have had their cloud and service credentials exfiltrated. This could grant attackers widespread access to:

  • Cloud Resources: Allowing them to spin up costly resources, steal sensitive data from storage, or shut down production services.
  • Source Code Repositories: Enabling theft of intellectual property or the injection of more malware into other projects.
  • CI/CD Pipelines: Providing a powerful pivot point to conduct further supply chain attacks by poisoning software builds.

Although the malicious packages were available for a short time, the high download rate of the package means a significant number of systems could have been compromised. The incident critically undermines trust in the security of open-source registries like PyPI.


IOCs — Directly from Articles

  • Malicious Package Versions: agent-framework==1.26.1, agent-framework==1.26.2

Cyber Observables — Hunting Hints

Security teams should hunt for signs of compromise in their development environments:

Type
file_name
Value
*.pth
Description
In Python site-packages directories, inspect the contents of .pth files for suspicious code that executes on startup.
Type
network_traffic_pattern
Value
Egress traffic from build agents to unknown IPs
Description
Monitor network connections from CI/CD runners or developer machines immediately after a Python interpreter starts. Look for unexpected connections.
Type
log_source
Value
Cloud provider audit logs (e.g., AWS CloudTrail)
Description
Search for API key usage from unexpected IP addresses or regions, which could indicate a stolen key is being used by attackers.
Type
file_path
Value
.../site-packages/agent_framework/
Description
Check the installation directory of the package for any suspicious, non-standard files compared to a known-good version.

Detection & Response

Detection

  • Dependency Scanning: Use dependency analysis tools to check if agent-framework versions 1.26.1 or 1.26.2 are present in any project's requirements.txt or lock files.
  • Endpoint Detection and Response (EDR): EDR solutions can be configured to alert on Python processes making unexpected network connections or accessing sensitive files like ~/.aws/credentials.
  • D3FEND: Use D3-FA: File Analysis to inspect the contents of installed Python packages against a known-good manifest to detect unauthorized modifications.

Response

  • Isolate: Immediately isolate any machine or CI/CD runner where the malicious packages were installed.
  • Credential Rotation: This is the most critical step. Rotate all potentially exposed credentials, including cloud IAM keys, API tokens, SSH keys, and service account passwords.
  • Remove Malicious Package: Uninstall the compromised package from all affected systems.
  • Audit Cloud Activity: Thoroughly review cloud audit logs for any unauthorized activity originating from the time of compromise.

Mitigation

Strategic Mitigation

  • Secure Publishing: PyPI project maintainers must enforce MFA on their accounts. Using API tokens scoped only for publishing, rather than long-lived passwords, can also reduce risk.
  • Use Lock Files: Developers should use dependency lock files (e.g., poetry.lock, pipfile.lock) which pin dependencies to specific versions with a hash. This prevents automatic updates to a newly published malicious version.
  • D3FEND: Implement D3-EAL: Executable Allowlisting principles by using a private package repository that vets and approves open-source packages before they are made available to internal developers.

Tactical Mitigation

  • Hash-Checking Mode: Use pip in its hash-checking mode (pip install --require-hashes -r requirements.txt) to ensure that the downloaded package matches the hash specified in your requirements file.
  • Vet Dependencies: Before adding a new dependency, vet its history and maintainers. Be cautious of packages with recent, unexplained changes in ownership.
  • Least Privilege in CI/CD: Ensure that CI/CD pipelines have the minimum necessary permissions to do their job, using short-lived, dynamically generated credentials where possible.

Timeline of Events

1
November 17, 2026
Malicious versions 1.26.1 and 1.26.2 of 'agent-framework' are published to PyPI within a 33-minute window.
2
November 17, 2026
The malicious packages are quarantined from PyPI, ending the direct distribution.
3
November 19, 2026
This article was published

MITRE ATT&CK Mitigations

Enforcing MFA on PyPI accounts is a critical step to prevent unauthorized publishing and account takeover.

Using dependency lock files with hashes prevents the automatic installation of new, potentially malicious package versions.

Audit

M1047enterprise

Auditing CI/CD logs and network traffic from build agents can help detect anomalous behavior like credential harvesting.

CI/CD pipelines should use short-lived, scoped credentials rather than static, long-term keys to minimize the impact of a compromise.

Timeline of Events

1
November 17, 2026

Malicious versions 1.26.1 and 1.26.2 of 'agent-framework' are published to PyPI within a 33-minute window.

2
November 17, 2026

The malicious packages are quarantined from PyPI, ending the direct distribution.

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Editorial Standards & Analyst Review

CyberNetSec.io uses automation to assist source monitoring, deduplication, observable extraction, and structured intelligence generation. Published analysis follows human-defined editorial standards and adds defensive context including MITRE ATT&CK, D3FEND, STIX, and Sigma where applicable. Read our editorial policy.

Tags

Supply Chain AttackPyPIMicrosoftPythonMalwareCredential TheftCloud SecurityCI/CD

📢 Share This Article

Help others stay informed about cybersecurity threats

🎯 MITRE ATT&CK Mapped

Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.

🧠 Enriched & Analyzed

Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.

🛡️ Actionable Guidance

Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.

🔗 STIX Visualizer

Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.

⚡ Sigma Generator

Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.