NPM is a package manager for the JavaScript programming language. In a blog post, Sophos senior threat researcher Sean Gallagher said the script in question installed a monero miner on Linux systems while on Windows systems malware that harvested credentials was dropped.
The account that was used was that of the developer of a package known as UAParser.js, a library used by Web applications to detect information about browser types and operating systems.
"The attacker used that access to modify the deployment package for the library, adding instructions to run a new script named preinstall.js," Gallagher wrote.
|
"The hijacker then pushed out the changes as three new versions: 0.7.29, 0.8.0, and 1.0.0."
After a few hours, the developer in question noticed something was amiss and published clean versions of the library.
Interestingly, the script that was dropped on Linux systems checked for the country code and did not run if the code returned was for Russian, Ukraine, Kazakhstan or Belarus.
The script downloaded a file from a server in Latvia which included the miner.
"The repeated attempts to use NPM to spread miners to Linux systems over the past month is further proof that Linux servers continue to be a very attractive target for cyber criminals – and stealing processing power for cryptomining is an easy way to monetise criminal access to these systems," Gallagher concluded.
"Many Linux servers run without any anti-virus protection installed because their operators want to avoid taking a performance hit, but that makes detection and mitigation of attacks like these more complex – and mining monero for someone else isn’t exactly optimizing server performance."