Shai Hulud 2.0, now with a wiper flavor
嗯,用户让我帮忙总结一篇文章的内容,控制在100字以内,而且不需要特定的开头。首先,我需要理解文章的主要内容。这篇文章讲的是Shai Hulud 2.0这种恶意软件,它通过感染npm包传播,窃取GitHub和云服务的凭证,并通过GitHub存储数据。此外,它还能自我复制到其他npm包中,并在无法传播时删除用户文件。 接下来,我得确定总结的关键点:恶意软件名称、传播方式、窃取的数据类型、数据存储方式、自我复制机制以及破坏性行为。然后,我需要用简洁的语言把这些点连贯地表达出来,确保不超过100字。 可能遇到的困难是如何在有限的字数内涵盖所有重要信息而不遗漏关键细节。我需要选择最核心的内容,比如传播机制、窃取的数据、数据存储和自我复制能力,以及破坏性措施。 最后,检查一下总结是否准确反映了原文内容,并且语言流畅自然。 </think> Shai Hulud 2.0是一种通过感染npm包传播的恶意软件,窃取GitHub和云服务凭证,并通过GitHub存储数据。它能自我复制到其他npm包中,并在无法传播时删除用户文件。 2025-12-3 20:10:47 Author: securelist.com(查看原文) 阅读量:4 收藏

In September, a new breed of malware distributed via compromised Node Package Manager (npm) packages made headlines. It was dubbed “Shai-Hulud”, and we published an in-depth analysis of it in another post. Recently, a new version was discovered.

Shai Hulud 2.0 is a type of two-stage worm-like malware that spreads by compromising npm tokens to republish trusted packages with a malicious payload. More than 800 npm packages have been infected by this version of the worm.

According to our telemetry, the victims of this campaign include individuals and organizations worldwide, with most infections observed in Russia, India, Vietnam, Brazil, China, Türkiye, and France.

Technical analysis

When a developer installs an infected npm package, the setup_bun.js script runs during the preinstall stage, as specified in the modified package.json file.

Bootstrap script

The initial-stage script setup_bun.js is left intentionally unobfuscated and well documented to masquerade as a harmless tool for installing the legitimate Bun JavaScript runtime. It checks common installation paths for Bun and, if the runtime is missing, installs it from an official source in a platform-specific manner. This seemingly routine behavior conceals its true purpose: preparing the execution environment for later stages of the malware.


The installed Bun runtime then executes the second-stage payload, bun_environment.js, a 10MB malware script obfuscated with an obfuscate.io-like tool. This script is responsible for the main malicious activity.

Stealing credentials

Shai Hulud 2.0 is built to harvest secrets from  various environments. Upon execution, it immediately searches several sources for sensitive data, such as:

  • GitHub secrets: the malware searches environment variables and the GitHub CLI configuration for values starting with ghp_ or gho_. It also creates a malicious workflow yml in victim repositories, which is then used to obtain GitHub Actions secrets.
  • Cloud credentials: the malware searches for cloud credentials across AWS, Azure, and Google Cloud by querying cloud instance metadata services and using official SDKs to enumerate credentials from environment variables and local configuration files.
  • Local files: it downloads and runs the TruffleHog tool to aggressively scan the entire filesystem for credentials.

Then all the exfiltrated data is sent through the established communication channel, which we describe in more detail in the next section.

Data exfiltration through GitHub

To exfiltrate the stolen data, the malware sets up a communication channel via a public GitHub repository. For this purpose, it uses  the victim’s GitHub access token if found in environment variables and the GitHub CLI configuration.


After that, the malware creates a repository with a randomly generated 18-character name and a marker in its description. This repository then serves as a data storage to which all stolen credentials and system information are uploaded.

If the token is not found, the script attempts to obtain a previously stolen token from another victim by searching through GitHub repositories for those containing the text, “Sha1-Hulud: The Second Coming.” in the description.

Worm spreading across packages

For subsequent self-replication via embedding into npm packages, the script scans .npmrc configuration files in the home directory and the current directory in an attempt to find an npm registry authorization token.

If this is successful, it validates the token by sending a probe request to the npm /-/whoami API endpoint, after which the script retrieves a list of up to 100 packages maintained by the victim.

For each package, it injects the malicious files setup_bun.js and bun_environment.js via bundleAssets and updates the package configuration by setting setup_bun.js as a pre-installation script and incrementing the package version. The modified package is then published to the npm registry.

Destructive responses to failure

If the malware fails to obtain a valid npm token and is also unable to get a valid GitHub token, making data exfiltration impossible, it triggers a destructive payload that wipes user files, primarily those in the home directory.


Our solutions detect the family described here as HEUR:Worm.Script.Shulud.gen.


Since September of this year, Kaspersky has blocked over 1700 Shai Hulud 2.0 attacks on user machines. Of these, 18.5% affected users in Russia, 10.7% occurred in India, and 9.7% in Brazil.

TOP 10 countries and territories affected by Shai Hulud 2.0 attacks (download)

We continue tracking this malicious activity and provide up-to-date information to our customers via the Kaspersky Open Source Software Threats Data Feed. The feed includes all packages affected by Shai-Hulud, as well as information on other open-source components that exhibit malicious behaviour, contain backdoors, or include undeclared capabilities.


文章来源: https://securelist.com/shai-hulud-2-0/118214/
如有侵权请联系:admin#unsafe.sh