Preventing the Next Package Manager Supply Chain Attack

The widely used NPM package ua-parser-js was compromised by attackers, with attackers publishing three malicious versions containing credential-stealing and cryptomining malware. Although the community detected and responded quickly, the attack highlights a recurring issue in today’s software ecosystem: many supply chain attacks are preventable using safeguards that have existed for decades.

This post summarizes what happened, how the compromise could have been blocked entirely, and which protections modern software platforms still need to adopt.

Attacking UA-Parser-JS

Supply chain attacks remain highly attractive to cybercriminals because a single compromise can impact millions of downstream systems. ua-parser-js is an ideal target:

  • Used by major companies such as Microsoft, Google, Amazon, and Facebook

  • Downloaded more than 8 million times per week

  • Integrated across countless Node.js projects

According to the maintainer, attackers gained access to his NPM account. With that access, they published three malicious versions—0.7.29, 0.8.0, and 1.0.0—which included:

  • Password-stealing code

  • Cookie harvesting

  • Cryptomining malware

On NPM, this is all an attacker needs: compromise a maintainer’s account, upload a malicious package, and hope that users install it before detection. The community reacted quickly, but not before some users installed the compromised versions and now must fully sanitize their environments.

A Better Way: Defense-in-Depth With Package Signing

Securing maintainers’ accounts is important, but it is only one layer of security. True protection requires defense-in-depth—and one of the most effective layers is package signing (also called code signing).

With cryptographic signing:

  • Authors sign each package version with a private key

  • Consumers verify the signature using the corresponding public key

  • Any tampering, impersonation, or unauthorized release is immediately detectable

These techniques are not new. Signing standards have existed for decades. A signing tool for NPM packages was even released back in 2018, but it failed to gain traction, largely due to the optional nature of signing and the lack of enforced verification.

And this isn’t unique to NPM. Across the software ecosystem:

  • Some platforms do not provide built-in signing mechanisms

  • Others support signing but do not enforce signature verification

  • Many rely entirely on maintainer account security—an inherently weak single point of failure

Signing only works if:

  1. Packages are consistently signed, and

  2. Signatures are verified at install time and/or runtime.

Without both, attackers can continue to exploit gaps in package distribution infrastructures.

Protecting Signing Keys Correctly

Even when signing is implemented, an attacker can still cause damage if they compromise the signing keys—similar to compromising an NPM account.

To prevent this:

  • Private signing keys must be stored in a hardware security module (HSM) or enterprise key management system (KMS)

  • Keys should remain non-exportable

  • Developers should use a proxied signing workflow, so private keys never touch endpoint devices

 

This eliminates entire classes of key-theft attacks and prevents unauthorized package publication.

Deploying a Secure Signing Solution

A robust signing workflow protects the integrity of your software and dramatically reduces the risk of supply chain compromise.

If your enterprise is ready to implement secure, centrally protected signing keys and high-assurance package integrity verification, take a look at GaraTrust—a platform designed to secure private keys in HSMs while providing fast, controlled, and auditable access for code signing and other cryptographic operations.

Looking to deploy a secure signing solution for your enterprise? Check out GaraTrust. 

https://www.youtube.com/watch?v=l3ifMzPdWOk

Share this post with your network.

LinkedIn
Reddit
Email