ua-parser-js 0.7.29, 0.8.0 and 1.0.0 on npm were published by attackers on 22 October 2021 and ran a hidden coin miner.
The package parses browser user-agent strings, and many projects use it. The GitHub advisory states that you must treat any computer that installed or ran one of these versions as fully compromised.
What happened
An attacker took over the package account and published three releases that ran a script at install time.
- Each release had a
preinstallentry inpackage.jsonthat ranpreinstall.js. - On Windows, the script downloaded
jsextension.exe, a Monero miner, from159.148.186[.]228. - It also downloaded
create.dll, the DanaBot banking trojan, fromcitationsherbe[.]at/sdd.dlland ran it withregsvr32.exe -s create.dll. - On Linux, the script downloaded the same miner, named
jsextension. It stopped if the machine was in Russia, Ukraine, Belarus or Kazakhstan. - The script did nothing on macOS.
The versions went up between 16:14 and 16:25 UTC on 22 October 2021. Mandiant also lists later hijacks of coa and rc on 4 November 2021.
Affected versions
ua-parser-js0.7.29, 0.8.0 and 1.0.0. The last good version of the old line is 0.7.28.- Patched: 0.7.30, 0.8.1 and 1.0.1.
coa2.0.3, 2.0.4, 2.1.1, 2.1.3 and 3.1.3. Safe: 2.0.2.rc1.2.9, 1.3.9 and 2.3.9. Safe: 1.2.8.
Indicators of compromise
- Files:
preinstall.js,jsextension.exe,jsextension,create.dllandsdd.dll. - MD5 of
jsextension.exe:fc724eb2894f34a3aca4b952d2f816cd. - MD5 of
sdd.dll(DanaBot):de8b54a938ac18f15cad804d79a0e19d. - Download host:
159.148.186[.]228. Download domain:citationsherbe[.]at. - DanaBot command servers (port 443):
185.158.250[.]216,45.11.180[.]153,194.76.225[.]46and194.76.225[.]61. - For
coaandrc: the domainpastorcryptograph[.]at.
How to check
Show every copy of the package in the tree and in the npm cache.
npm ls ua-parser-js coa rc --all
grep -rEn "ua-parser-js@(0.7.29|0.8.0|1.0.0)|\"version\": \"(0.7.29|0.8.0|1.0.0)\"" package-lock.json
If you are unsure whether a machine installed a bad version, also search it for the dropped files, jsextension, jsextension.exe and create.dll.
What to do now
- Upgrade to 0.7.30, 0.8.1 or 1.0.1. Check
coaandrctoo. - If a bad version installed, treat the machine as fully compromised. Rotate every secret and key from a clean system.
- Remove the dropped files
jsextension,jsextension.exeandcreate.dll. Removing the package does not remove malware that its install script placed. - Run a forensic review for unauthorized access. Lock dependency versions.
What Vigilance would show
These examples show an install hold and the corresponding owner report.
Example install message
Vigilance blocked `ua-parser-js` 0.7.29. This version is too new or changed in a way Vigilance must check first.
Example owner report
Bad update
ua-parser-js 0.7.29
Installing the library now quietly downloaded and ran a program that mined coins and stole saved passwords.
No security team? See who reads the alert.
Frequently asked questions
What did the malicious versions install?
On Windows they installed a Monero miner and the DanaBot banking trojan. On Linux they installed the miner.
What happened to coa and rc?
Mandiant lists later hijacks on 4 November 2021 that delivered a modified DanaBot DLL.
Sources
Send this page to the person who looks after AI at your company.