How the Shai-Hulud 2.0 attack spread through trusted npm packages
Public report: 24 November 2025. Updated: 17 November 2026.
The Shai-Hulud 2.0 attack demonstrates how a normal software installation can become an organisation-wide credential incident. A developer may install a familiar package for a legitimate task, while the package's installation process runs code with access to the developer's environment. When that environment contains publishing credentials, the compromise can spread beyond its first victim.
What happened
Researchers identified a second Shai-Hulud-style npm worm on 24 November 2025. Datadog's analysis documented hundreds of compromised packages, credential theft and propagation through further package releases. Stolen information was placed in public GitHub repositories, creating an exposure that could persist after malicious packages were removed.
This was a campaign against the software distribution ecosystem, rather than one application's isolated vulnerability. A package's download count describes potential reach, not a confirmed number of compromised organisations. Whether a particular business was affected depends on the exact versions installed, when installation occurred and which credentials the executing environment could access.
Understanding the timeline
The relevant sequence runs from publication of a malicious package version, through installation or build activity, to possible use of stolen credentials. The public discovery date is only one point in that sequence. A business investigating exposure needs its own installation records and credential history.
Removal from a registry closes a distribution route; it does not revoke credentials already copied elsewhere. That distinction should shape both incident communications and the order of technical recovery.
Why a package worm is different
An ordinary malicious dependency may compromise the machine that installs it. Self-propagating package malware can also use that machine's legitimate publishing authority to reach new projects. This turns access intended for a trusted maintainer into a distribution mechanism for the next stage.
The environment around an installation determines its consequences. A disposable build worker with no sensitive credentials presents a different opportunity from a maintainer's laptop holding cloud sessions, SSH keys and package-publishing access. Both may run the same package, but their reachable assets are very different.
Npm publishing credentials deserve particular protection because they can affect people outside the credential owner's organisation. A token that publishes a widely used package represents authority over future installations across many independent environments. Its value is not limited to the source repository beside it.
The campaign also challenges a common interpretation of dependency trust. A familiar package name, an established maintainer and a legitimate registry account can all remain visible while a specific release is malicious. Trust needs to attach to the reviewed artefact and the process that produced it, not just the project's reputation.
What this means for a business
The first operational question is where installations happened. Developer laptops, scheduled dependency updates, container builds and release workers may have different records. An inventory that lists only production applications can miss an exposed build machine that subsequently deployed apparently normal software.
The second question is what those environments could reach. A stolen cloud credential may affect a service that never used the compromised package. An incident team therefore needs to follow credentials outward from the installation, rather than searching only for the package inside the original application.
The third question concerns onward distribution. If a publishing identity was present, the organisation needs to check releases it produced during the exposure period and communicate with downstream users where necessary. This responsibility can make a small internal incident into a supplier incident for customers.
Public repositories containing stolen secrets add urgency, but deleting those repositories is not sufficient. Once a secret has been exposed publicly, the owner cannot establish who copied it. Recovery should make the old credential unusable and review activity performed while it remained valid.
How penetration testers assess similar weaknesses
An authorised supply-chain review should map the relationship between dependency installation, build execution and credential availability. Testers can examine whether a harmless installation-time action in a controlled package could access secrets that its task does not require. This should use synthetic credentials and an agreed test registry or isolated environment.
The assessment should distinguish different types of worker. A pull-request validation job, a release job and an interactive developer session should not automatically have the same authority. A useful finding explains which unnecessary capability crosses the boundary and what business asset it controls.
Testing can also examine whether changes to publishing identities, unexpected package releases and unusual repository creation generate useful alerts. The result should be measured through the response process: who receives the signal, whether the affected project is identified and how quickly the credential can be disabled.
Finally, an exposure exercise can start with a known test package version and ask the team to find every environment that installed it. The exercise measures inventory quality without introducing malicious software. It often reveals missing evidence in short-lived workers and automatically rebuilt containers.
How to reduce the risk
Keep untrusted dependency execution away from release authority. Use separate jobs and identities for reviewing changes, building artefacts and publishing releases. Supply each stage with only the permissions required for its current task.
Prefer short-lived publishing credentials tied to an approved workflow where the registry supports that model. Review the exact trust conditions and the people who can alter them. A modern authentication mechanism still needs a protected workflow and a controlled source of build inputs.
Maintain reliable lockfiles, dependency change review and artefact records. Version pinning helps identify what was installed, but it cannot make a malicious pinned version safe. Record enough information to connect a release to its dependencies and build environment.
Reduce the value of developer-machine compromise. Separate production administration from routine development, avoid unnecessary long-lived secrets and use isolated environments for unfamiliar tooling. A laptop should not become a convenient bridge between package installation and every production service.
When exposure is confirmed, preserve relevant evidence, isolate the affected environment and revoke reachable credentials from a trusted system. Rebuild compromised workers before supplying replacement secrets. Otherwise the same access path may capture the new credentials immediately.
A useful investigation output is a map of where an affected package actually executed. A package appearing in a lockfile is different from a package running on a developer laptop with a signed-in repository session. The same version running inside a disposable build with no publishing authority presents another exposure. Record the environment, execution time and accessible credentials before deciding which tokens to replace. This avoids treating every installation as identical while still identifying the high-authority systems that deserve the earliest response.
A newly issued token should not be placed back into an environment that has not been assessed. Otherwise, a rotation exercise can provide the same compromised process with a fresh credential. Establish a clean route for rebuilding the affected worker or workstation, then verify that the replacement token has only the permissions needed by that workflow.
A useful readiness exercise
Select one application and identify its last successful dependency installation, the worker that performed it and every credential available to that worker. Then ask whether the organisation could reproduce that answer for a build completed a month earlier.
If the answer depends on a vanished container or an individual's memory, improve the evidence before the next emergency. The goal is a repeatable chain from package version to execution environment, reachable secrets and affected services. That chain makes a broad supply-chain alert something a business can investigate and contain with confidence.
References
<https://securitylabs.datadoghq.com/articles/shai-hulud-2.0-npm-worm/>
Related issues
- How the Trust Wallet extension compromise bypassed release controls
- How the Trivy supply-chain compromise reached downstream AI software
- How the TanStack supply-chain attack crossed build-pipeline boundaries
Read about our methodology or contact pentested.com to discuss security testing for your organisation.