Popular npm packages compromised

Unknown attackers have compromised several popular npm packages in a supply-chain attack.

Popular npm packages compromised

Several popular npm packages used in a number of web projects have been compromised and trojanized by unknown attackers. The attackers, through a phishing attack on maintainers, were able to gain access to at least one repository and injected the packages with malicious code used to hunt for cryptocurrency. Thus, all web applications that used trojanized versions of the packages were turned into cryptodrainers. And there can be quite a few of them — as the compromised packages had more than two billion downloads per day (according to Aikido Security).

What are the dangers of the trojanized packages used in this attack?

Obfuscated JavaScript was added to all affected packages. If the compromised package is used in a web application, the malicious code is activated on the devices that were used to access this application. Acting at the browser level, malware intercepts network traffic and API requests, and changes data associated with Ethereum, Bitcoin, Solana, Litecoin, Bitcoin Cash, and Tron cryptocurrency wallets. The malware spoofs their addresses and redirects transactions to the attackers’ wallets.

About three hours after the attack began, the npm administration started to remove the infected packages, but it’s not known exactly how many times they were downloaded during this time.

How the attackers managed to gain access to the repositories

The attackers used a rather banal technique — they created a phishing email in which maintainers were urged to update their two-factor authentication credentials at the first opportunity. Otherwise, they were threatened with account lockout starting September 10, 2025. The emails were sent from a mailbox on the domain npmjs[.]help, similar to the legitimate npmjs.com. The same domain also hosted a phishing site that mimicked the official npm registry page. Credentials entered on this site immediately fell into the hands of the attackers.

The attack was successful against at least one maintainer, compromising the npm packages color, debug, ansi-regex, chalk, and several others. However, the phishing attack appears to have been more extensive, because other maintainers and developers received similar phishing emails, so the full list of trojanized packages may be longer.

Which packages were compromised?

At the time of writing this post, the following packages are known to be compromised:

  • ansi-regex
  • ansi-styles
  • backslash
  • chalk
  • chalk-template
  • color-convert
  • color-name
  • color-string
  • debug
  • error-ex
  • has-ansi
  • is-arrayish
  • simple-swizzle
  • slice-ansi
  • strip-ansi
  • supports-color
  • supports-hyperlinks
  • wrap-ansi

However, as we have already written above, the list may grow. You can keep an eye on the GitHub advisory page for updates.

How to stay safe

Kaspersky Lab products, both for home and for corporate users, successfully detect and stop the malware used in this attack.

Developers are advised to audit the dependencies in their projects, and if one of the compromised packages was used there, pin the safe version using the overrides function in package.json. You can find more detailed instructions here.

Maintainers and developers with access to open source software repositories are advised to be doubly careful when receiving emails urging them to log into their accounts. Better yet — also use security solutions with an anti-phishing engine.

Tips