Skip to content
Shai Hulud 2 0 Guidance For Detecting Investigating And Defending Against The Supply Chain Attack

Shai Hulud 2 0 Guidance For Detecting Investigating And Defending Against The Supply Chain Attack

www.microsoft.com • November 11, 2026

The Shai‑Hulud 2.0 supply chain attack represents one of the most significant cloud-native ecosystem compromises observed recently. Attackers maliciously modified hundreds of publicly available packages, targeting developer environments, continuous integration and continuous delivery (CI/CD) pipelines, and cloud-connected workloads to harvest credentials and configuration secrets

Update May 13, 2026: Microsoft Defender has protection coverage for the recent Mini Shai-Hulud activity resurgence .

The Shai‑Hulud 2.0 campaign builds on earlier supply chain compromises but introduces more automation, faster propagation, and a broader target set:

Malicious code executes during the preinstall phase of infected npm packages, allowing execution before tests or security checks.

Attackers have compromised maintainer accounts from widely used projects (for example, Zapier, PostHog, Postman).

Stolen credentials are exfiltrated to public attacker-controlled repositories, which could lead to further compromise.

This campaign illustrates the risks inherent to modern supply chains:

Traditional network defenses are insufficient against attacks embedded in trusted package workflows.

Compromised credentials enable attackers to escalate privileges and move laterally across cloud workloads.

In defending against threats like Shai-Hulud 2.0, organizations benefit significantly from the layered protection from Microsoft Defender, which provides security coverage from code, to posture management, to runtime. This defense-in-depth approach is especially valuable when facing supply chain-driven attacks that might introduce malicious dependencies that evade traditional vulnerability assessment tools. In these scenarios, the ability to correlate telemetry across data planes, such as endpoint or container behavior and runtime anomalies, becomes essential. Leveraging these insights enables security teams to rapidly identify compromised devices, flag suspicious packages, and contain the threat before it propagates further.

This blog provides a high-level overview of Shai‑Hulud 2.0, the attack mechanisms, potential attack propagation paths, customized hunting queries, and the actions Microsoft Defender is taking to enhance detection, attack-path analysis, credential scanning, and supply chain hardening.

Analyzing the Shai-Hulud 2.0 attack

Multiple npm packages were compromised when threat actors added a preinstall script named set_bun.js in the package.json of the affected packages. The setup_bun.js script scoped the environment for an existing Bun runtime binary; if not found, the script installed it. Bun can be used in the same way Node.js is used.

The Bun runtime executed the bundled malicious script bun_environment.js . This script downloaded and installed a GitHub Actions Runner archive. It then configured a new GitHub repository and a runner agent called SHA1Hulud . Additional files were extracted from the archive including, TruffleHog and Runner.Listener executables. TruffleHog was used to query the system for stored credentials and retrieve stored cloud credentials.

Microsoft Defender for Containers promptly notified our customers when the campaign began through the alert Suspicious usage of the shred command on hidden files detected . This alert identified the data destruction activity carried out as part of the campaign. Additionally, we introduced a dedicated alert to identify this campaign as Sha1-Hulud Campaign Detected – Possible command injection to exfiltrate credentials.

In some cases, commits to the newly created repositories were under the name “Linus Torvalds”, the creator of the Linux kernel and the original author of Git. The use of fake personas highlights the importance of commit signature verification , which adds a simple and reliable check to confirm who actually created a commit and reduces the chance of impersonation.

Mini Shai-Hulud Expanded Campaign (May 2026)

On May 11, 2026, Microsoft Security Research identified a significant resurgence of the Shai-Hulud supply chain campaign tracked as Mini Shai-Hulud, compromising 170+ npm packages and 2 PyPI packages across 404 malicious versions. This represents a major escalation in both scale and sophistication from the original Shai-Hulud 2.0 campaign documented in December 2025 and marks the first supply chain attack to simultaneously span both the npm and PyPI registries in a single coordinated operation. The updated attack chain is as follows:

node (npm install) → node (npm cli) : The developer runs a routine npm install. Node.js spawns the npm CLI to resolve and install dependencies. This is the entry point.

sh -c “bun run FilePII_81026b…17773.js && exit 1 “: When npm resolves the malicious @tanstack/setup optional dependency, it clones the attacker’s fork commit from GitHub into .npm/_cacache/tmp/git-clone*/. The prepared script fires, spawning a shell that:

• bun run .js – executes the 2.3 MB triple-obfuscated credential stealer using the Bun JS runtime

• && exit 1 – deliberately exits with error code 1 so npm treats the optional dependency as a “failed install” and moves on silently. The developer sees no error. But the payload has already executed in the background.

bun.exe (runs payload from .npm/_cacache/tmp/git-clone*/…) Bun runtime (downloaded or bundled) executes the payload from npm’s internal cache directory. This is where the triple deobfuscation happens (obfuscator.io string table → PBKDF2 cipher → AES-256-GCM decryption) and the credential harvester modules activate.

zsh (claude shell-snapshot commands) The payload spawns a zsh shell to execute Claude Code shell-snapshot commands – this is the persistence and secondary spread vector. It’s writing the .claude/settings.json SessionStart hook so that every future Claude Code session on this machine re-executes the payload. This is also where it probes for Claude’s own authentication context.

aws sso / credential enumeration The harvester module kicks in – it’s actively enumerating AWS SSO credentials, probing:

• AWS IMDS v2 (169.254.169.254) for instance role credentials

• ECS metadata (169.254.170.2) for container credentials

• Local ~/.aws/credentials, ~/.aws/config for static keys

• Active SSO session tokens

This is just one of multiple file paths being scanned (Azure, GCP, K8s, Vault, SSH, npm tokens, crypto wallets all happen in parallel).

file drops in .claude/ directories The payload writes its persistence files:

• .claude/settings.json – SessionStart hook

• .claude/setup.mjs – bootstrap script

• .claude/router_runtime.js – full 2.3 MB self-copy of the payload

These get committed into the victim’s repos via GitHub GraphQL, creating the secondary developer infection vector.

Microsoft Defender provides protection for this most recent mini Shai Hulud activity.

Mitigation and protection guidance

Microsoft Defender recommends the following guidance for customers to improve their environments’ security posture against Shai-Hulud:

Review the Key Vault assets on the critical asset management page and investigate any relevant logs for unauthorized access.

Rapidly rotate and revoke exposed credentials.

Isolate affected CI/CD agents or workspaces.

Prioritize high-risk attack paths to reduce further exposure.

Remove unnecessary roles and permissions granted to identities assigned to CI/CD pipelines; specifically review access to key vaults.

For Defender for Cloud customers, read on the following recommendation: As previously indicated, the attack was initiated during the preinstall phase of compromised npm packages. Consequently, cloud compute workloads that rely on these affected packages present a lower risk compared to those involved in the build phase. Nevertheless, it is advisable to refrain from using such packages within cloud workloads. Defender for Cloud conducts thorough scans of workloads and prompts users to upgrade or replace any compromised packages if vulnerable versions are detected. Additionally, it references the code repository from which the image was generated to facilitate effective investigation. To receive code repository mapping, make sure to connect your DevOps environments to Defender for Cloud. Refer to the following documentation for guidance on: Connecting Azure DevOps to Defender for Cloud Connecting GitHub environment to Defender for Cloud Connecting GitLab environment to Defender for Cloud Deploying Defender CLI for container image scan

As previously indicated, the attack was initiated during the preinstall phase of compromised npm packages. Consequently, cloud compute workloads that rely on these affected packages present a lower risk compared to those involved in the build phase. Nevertheless, it is advisable to refrain from using such packages within cloud workloads. Defender for Cloud conducts thorough scans of workloads and prompts users to upgrade or replace any compromised packages if vulnerable versions are detected. Additionally, it references the code repository from which the image was generated to facilitate effective investigation.

To receive code repository mapping, make sure to connect your DevOps environments to Defender for Cloud. Refer to the following documentation for guidance on: Connecting Azure DevOps to Defender for Cloud Connecting GitHub environment to Defender for Cloud Connecting GitLab environment to Defender for Cloud Deploying Defender CLI for container image scan

Connecting Azure DevOps to Defender for Cloud

Connecting GitHub environment to Defender for Cloud

Connecting GitLab environment to Defender for Cloud

Deploying Defender CLI for container image scan

For npm maintainers: Use npm trusted publishing instead of tokens. Strengthen publishing settings on accounts, organizations, and packages to require two-factor authentication (2FA) for any writes and publishing actions. When configuring two-factor authentication , use WebAuthn instead of a time-based, one-time password (TOTP).

Use npm trusted publishing instead of tokens. Strengthen publishing settings on accounts, organizations, and packages to require two-factor authentication (2FA) for any writes and publishing actions.

When configuring two-factor authentication , use WebAuthn instead of a time-based, one-time password (TOTP).

To combat this evolving threat, we are also introducing a new functionality in Microsoft Defender for Cloud that identifies Shai-Hulud 2.0 packages by leveraging agentless code scanning . This capability works by creating a Software Bill of Materials (SBOM) in the background and performing a lookup to identify if any package in the filesystem or source code repository is a malicious package that could be a component of the Shai-Hulud attack. By decoupling security analysis from runtime execution, this approach ensures that deep dependency threats are detected without impacting the performance of workloads or pipelines. If malicious packages are found, recommendations in Microsoft Defender for Cloud provide immediate visibility into compromised assets as shown below. This ensures that security teams can act quickly to freeze dependencies and rotate credentials before further propagation occurs. The recommended step for customers is to start scanning repositories and protecting supply chains. Learn how to set up connectors .

If malicious packages are found, recommendations in Microsoft Defender for Cloud provide immediate visibility into compromised assets as shown below. This ensures that security teams can act quickly to freeze dependencies and rotate credentials before further propagation occurs.

The recommended step for customers is to start scanning repositories and protecting supply chains. Learn how to set up connectors .

Turn on cloud-delivered protection and automatic sample submission on Microsoft Defender Antivirus. These capabilities use artificial intelligence and machine learning to quickly identify and stop new and unknown threats.

Turn on attack surface reduction rules , particularly on blocking executable files from running unless they meet a prevalence, age or trusted list criterion and blocking execution of potentially obfuscated scripts .

For more information on GitHub’s plans on securing the npm supply chain and what npm maintainers can take today, Defender also recommends checking the Github plan for a more secure npm supply chain .

Microsoft Defender XDR detections

Microsoft Defender XDR customers can refer to the list of applicable detections below. Microsoft Defender XDR coordinates detection, prevention, investigation, and response across endpoints, identities, email, and apps to provide integrated protection against attacks like the threat discussed in this blog.

Customers with provisioned access can also use Microsoft Security Copilot in Microsoft Defender to investigate and respond to incidents, hunt for threats, and protect their organization with relevant threat intelligence.

Microsoft Security Copilot

Security Copilot customers can use the standalone experience to create their own prompts or run the following prebuilt promptbooks to automate incident response or investigation tasks related to this threat:

Incident investigation

Microsoft User analysis

Threat Intelligence 360 report based on MDTI article

Vulnerability impact assessment

Note that some promptbooks require access to plugins for Microsoft products such as Microsoft Defender XDR or Microsoft Sentinel.

Threat intelligence reports

Microsoft Defender XDR customers can use the following threat analytics reports in the Defender portal (requires license for at least one Defender XDR product) to get the most up-to-date information the threat actor, malicious activity, and techniques discussed in this blog. These reports provide the intelligence, protection information, and recommended actions to prevent, mitigate, or respond to associated threats found in customer environments.

Microsoft Defender XDR threat analytics:

Activity Profile: From vulnerable workflows to self-replicating malware: Technical analysis of npm supply chain security incidents

Microsoft Security Copilot customers can also use the Microsoft Security Copilot integration in Microsoft Defender Threat Intelligence, either in the Security Copilot standalone portal or in the embedded experience in the Microsoft Defender portal to get more information this threat actor.

Attack path analysis shows paths from exposed entry points to targets. Security teams can use attack path analysis to surface cross-domain exposure risks, for example how an attacker could move from externally reachable resources to sensitive systems to escalate privileges and maintain persistence. While supply chain attacks like those used by Shai-Hulud 2.0 can originate without direct exposure, customers can leverage advanced hunting to query the Exposure Graph for these broader relationships.

For example, once a virtual or physical machine is determined to be compromised, key vaults that are directly accessible using credentials obtained from the compromised system can also be identified. The relevant access paths can be extracted using queries, as detailed in the hunting section below. Any key vault found along these paths should be investigated according to the mitigation guide.

Microsoft Defender XDR

Microsoft Defender XDR customers can run the following queries to find related activity in their networks:

Attempts of malicious JS execution through node

Suspicious process launched by malicious JavaScript

Paths from compromised machines and repositories to cloud key management services

Setup of the GitHub runner with the malicious repository and downloads of the malicious bun.sh script that facilitates this

Credential collection using TruffleHog and Azure CLI

Cloud security explorer

Microsoft Defender for Cloud customers can also use cloud security explorer to surface possibly compromised software packages. The following screenshot represents a query that searches for a virtual machine or repository allowing lateral movement to a key vault. View the query builder .

The security explorer templates library has been expanded with two additional queries that retrieve all container images with compromised software packages and all the running containers with these images.

Another means for security teams to proactively identify the scope of this threat is by leveraging the Cloud Security Explorer to query the granular Software Bill of Materials (SBOM) generated by agentless scanners. This capability allows you to execute dynamic, graph-based queries across your entire multi-cloud estate—including virtual machines, containers, and code repositories—to pinpoint specific software components and their versions without the need for agent deployment.

For the Shai-Hulud 2.0 campaign, you can use the Cloud Security Explorer to map your software inventory directly to the list of known malicious packages. By running targeted queries that for the specific compromised package names identified in our threat intelligence, you can instantly visualize the blast radius of the attack within your environment. This enables you to locate every asset containing a malicious dependency and prioritize remediation efforts effectively.

Microsoft Sentinel customers can use the TI Mapping analytics (a series of analytics all prefixed with ‘TI map’) to automatically match the malicious domain indicators mentioned in this blog post with data in their workspace. If the TI Map analytics are not currently deployed, customers can install the Threat Intelligence solution from the Microsoft Sentinel Content Hub to have the analytics rule deployed in their Sentinel workspace.

Indicators of compromise

aikdo: Shai Hulud Launches Second Supply-Chain Attack: Zapier, ENS, AsyncAPI, PostHog, Postman Compromised

For the latest security research from the Microsoft Threat Intelligence community, check out the Microsoft Threat Intelligence Blog .

To hear stories and insights from the Microsoft Threat Intelligence community the ever-evolving threat landscape, listen to the Microsoft Threat Intelligence podcast .

Extracted Entities

No entities detected