Supply Chain Attack on Open-Source Packages Self-Replicating Worm Spreads in the JavaScript Ecosystem

From Sebastian Gerstl | Translated by AI 3 min Reading Time

Related Vendors

The malware attack on the npm repository, which distributes open-source packages for the widely used programming language JavaScript, is far more severe than feared: A malware worm introduced into the system has now infected over 180 software packages.

At least 180 open-source packages distributed via the npm repository for the JavaScript programming language are infected by a self-replicating worm. The malware steals credentials and identifies repositories of other open-source packages, infiltrating them and further spreading throughout the npm ecosystem.(Image: freely licensed /  Pixabay)
At least 180 open-source packages distributed via the npm repository for the JavaScript programming language are infected by a self-replicating worm. The malware steals credentials and identifies repositories of other open-source packages, infiltrating them and further spreading throughout the npm ecosystem.
(Image: freely licensed / Pixabay)

Cybersecurity experts have identified a new wave of malware being distributed through the npm package registry. Although the malware being spread this time is of a different nature, it is believed to stem from the same attack on the repository discovered last week, which distributes open-source software packages for the JavaScript programming language.

"The compromised versions contain a function (NpmModule.updatePackage) that downloads a package tarball, modifies the package.json file, inserts a local script (bundle.js), repacks the archive, and republishes it, enabling an automatic trojanization of downstream packages," states a blog post by Socket, which also highlighted the first malware attack. Such self-replicating malware, also known as a worm, can rapidly spread further through the infected repository.

Other security researchers have also consistently reported on the malware. Unlike last week’s attack, however, the worm does not deploy hidden cryptocurrency mining software but is potentially much more dangerous: it specifically targets and exfiltrates sensitive credentials from infected systems. The worm is spreading rapidly: while initial reports mentioned 40 affected packages, the majority now believe over 180 packages have been compromised; some estimates fear it could already be over 500..

Operation of the Malware

The Software Supply Chain Worm, which automatically replicates itself via dependent packages, operates as follows: malicious code is executed when compromised packages are installed. On the infected system, the injected malware scans local systems for secret tokens (e.g., GITHUB_TOKEN, AWS_ACCESS_KEY_ID) and exfiltrates them via webhooks to external servers. The attack affects both Windows and Linux systems.

Subsequently, a file named bundle.js injected into the infected packages uses legitimate tools like TruffleHog to locate credentials for other packages distributed via the npm repository. GitHub repositories are then created or modified, workflows are injected, and new compromised versions of other packages are automatically published – including malicious code. Further insights into the malware's operation are provided by the StepSecurity blog.

The attackers use the repository "Shai-Hulud," named after the legendary sandworms from the science fiction epic Dune. The name is more than just a pop culture reference – the analogy to a worm burrowing through the ecosystem and spreading uncontrollably fits alarmingly well.

Among the affected packages are those from the @ctrl ecosystem, the NativeScript community, as well as numerous projects related to CrowdStrike. Particularly concerning: Some of these packages, such as @ctrl/tinycolor, achieve millions of downloads weekly.

Connection to the Recent Attack Seems Likely

According to ReversingLabs, the attack likely began with the package rxnt-authentication, which was published on September 14. The associated account, techsupportrxnt, is currently considered "Patient Zero." It remains unclear exactly how the account was compromised – phishing or a faulty GitHub workflow configuration are considered possible causes.

CrowdStrike responded immediately and removed the affected packages from the registry. According to their own statement, the platform itself was not affected. Internal keys have been rotated, and a thorough investigation is underway in collaboration with the npm team.

The impact of the campaign is far-reaching: An analysis of the stolen data, according to GitGuardian, has already revealed at least 278 compromised secrets, including 188 that were leaked directly through manipulated GitHub workflows. Security researchers are calling it a "cascade compromise" of the npm ecosystem.

Developers are strongly advised to check their environments for affected package versions, immediately rotate tokens and credentials, and review all build processes. Projects that perform automatic deployments and publishing without adequately isolating secrets are particularly at risk.

Security Researchers Urge Greater Awareness in the Use of Open-Source Packages

In the long term, the incident once again raises the question of the resilience of open-source infrastructures. The close integration of developer accounts, CI/CD pipelines, and package managers requires not only technological protective measures but also a higher level of awareness – particularly in professional DevOps and security teams.

Subscribe to the newsletter now

Don't Miss out on Our Best Content

By clicking on „Subscribe to Newsletter“ I agree to the processing and use of my data according to the consent form (please expand for details) and accept the Terms of Use. For more information, please see our Privacy Policy. The consent declaration relates, among other things, to the sending of editorial newsletters by email and to data matching for marketing purposes with selected advertising partners (e.g., LinkedIn, Google, Meta)

Unfold for details of your consent

The following packages have been clearly identified as compromised by Socket:

  • angulartics2@14.1.2
  • @ctrl/deluge@7.2.2
  • @ctrl/golang-template@1.4.3
  • @ctrl/magnet-link@4.0.4
  • @ctrl/ngx-codemirror@7.0.2
  • @ctrl/ngx-csv@6.0.2
  • @ctrl/ngx-emoji-mart@9.2.2
  • @ctrl/ngx-rightclick@4.0.2
  • @ctrl/qbittorrent@9.7.2
  • @ctrl/react-adsense@2.0.2
  • @ctrl/shared-torrent@6.3.2
  • @ctrl/tinycolor@4.1.1, @4.1.2
  • @ctrl/torrent-file@4.1.2
  • @ctrl/transmission@7.3.1
  • @ctrl/ts-base32@4.0.2
  • encounter-playground@0.0.5
  • json-rules-engine-simplified@0.2.4, 0.2.1
  • koa2-swagger-ui@5.11.2, 5.11.1
  • @nativescript-community/gesturehandler@2.0.35
  • @nativescript-community/sentry@4.6.43
  • @nativescript-community/text@1.6.13
  • @nativescript-community/ui-collectionview@6.0.6
  • @nativescript-community/ui-drawer@0.1.30
  • @nativescript-community/ui-image@4.5.6
  • @nativescript-community/ui-material-bottomsheet@7.2.72
  • @nativescript-community/ui-material-core@7.2.76
  • @nativescript-community/ui-material-core-tabs@7.2.76
  • ngx-color@10.0.2
  • ngx-toastr@19.0.2
  • ngx-trend@8.0.1
  • react-complaint-image@0.0.35
  • react-jsonschema-form-conditionals@0.3.21
  • react-jsonschema-form-extras@1.0.4
  • rxnt-authentication@0.0.6
  • rxnt-healthchecks-nestjs@1.0.5
  • rxnt-kue@1.0.7
  • swc-plugin-component-annotate@1.9.2
  • ts-gaussian@3.0.6

A regularly updated list of the affected packages is provided, among others, by the security blog Aikido.dev.(sg)