ua-parser-js is hijacked to ship a miner and password stealer

ATG-class event22 October 2021

For about four hours, malicious versions of a library downloaded seven to eight million times a week installed a cryptocurrency miner and, on Windows, a password stealer on machines that installed them.

Position
The npm publishing account of a widely used library
Reach
About 7 to 8 million weekly downloads; dependents include large technology companies
Category
Open-Source Maintainer Infiltration

What happened

ua-parser-js reads a browser's user-agent string to tell software what device and browser it is dealing with. On 22 October 2021 three malicious versions were published to npm from the maintainer's account, which he believed had been hijacked. For about four hours, any machine that installed them received a Monero miner and, on Windows, a credential stealer. CISA issued an alert the same day. A Russian forum post weeks earlier had offered a developer account matching the package's profile for $20,000, but the link was never confirmed.

The ATG nexus

One account held publishing rights for code that millions of builds pulled in automatically. Whoever controlled that account controlled what those builds received. The confirmed record cites ua-parser-js as maintainer takeover, the pathway by which a single person's credentials become everyone's dependency. Where the package ships inside client bundles, the same control reaches every device that runs them.

Limits of the comparison

This payload hit developer and build machines that installed the package, and the exposure lasted hours. It did not act on website visitors' screens.

On this site

Sources

  1. Malware Discovered in Popular NPM Package, ua-parser-jsCISA, 22 October 2021Primary source
  2. NPM Library (ua-parser-js) Hijacked: What You Need to KnowRapid7, 25 October 2021
  3. Popular npm Project Used by Millions Hijacked in Supply-Chain AttackSonatype, 25 October 2021

Back to this event on the timeline