Malicious NPM Packages Used To Install njRAT Remote Access Trojan

Malicious NPM Packages Used To Install njRAT Remote Access Trojan

New malicious NPM packages have been discovered that install the njRAT remote access trojan that allows hackers to gain control over a computer.

NPM is a JavaScript package manager that allows developers and users to download packages and integrate them into their projects.

As NPM is an open ecosystem, anyone can upload a new package without being reviewed or scanned for malware. While this environment has led to a repository of 1 million rich and diverse packages, it also makes it easy for threat actors to upload malicious packages.

Malicious NPMs install njRAT

Today, open-source security firm Sonatype discovered malicious NPM packages masquerading as a legitimate tool to make databases out of JSON files.

These packages were called ‘jdb.js’ and ‘db-json.js’ and have been removed by NPM, but as you can see from a screenshot below, they look like harmless packages that could be used to add new functionality to a project.

JsonDB (db-json.js) package on NPM

As you can see from the package.json file for the db-json.js package, it has another package called ‘jdb.js’ as a dependency. The package.json file causes NPM to automatically install that package as well when installing the db-json.js package.

Package.json for db-json

This jdb.js package includes a module.js, package.json, and a patch.exe executable, as shown below. When installed, NPM will automatically execute the module.js as it is set to launch automatically on install.

Also Read: 10 Tips For Drafting Key Terms In A Service Agreement

jdb package contents

This JS script, shown below, is heavily obfuscated but will launch the patch.exe executable, which is the njRAT malware.

Obfuscated JavaScript file

When installed, njRAT gives the threat actor full remote access to a victim’s computer, where they can perform the following malicious behavior:

  • Modify the Windows Registry
  • Create and delete files
  • Upload files
  • Execute commands
  • Get information about the computer
  • Take control over the computer
  • Log keystrokes
  • Steal passwords
  • Kill processes
  • Take screenshots

Below you can see a small snippet of source code showing some commands that can be sent by the threat actor via njRAT.

Also Read: Deemed Consent PDPA: How Do Businesses Comply?

njRAT decompiled source code

Each package was downloaded about a hundred times each, but Sonatype’s Ax Sharma told BleepingComputer that they believe they caught the malicious NPMs before they could be put to full use.

Over the past year, it has become increasingly common to find NPM packages that install malware or perform malicious behavior.

Recently, NPM removed malicious packages called ‘fallguy’ and ‘discord.dll’ after discovering that they were used to steal Discord tokens and browser information from Google Chrome, Brave Browser, Opera, and Yandex Browser.

As it is becoming common for malicious NPM projects to utilize names similar to legitimate projects, developers must pay close attention to the packages they integrate into their projects.

Privacy Ninja

Recent Posts

Role of Enhanced Access Controls in Safeguarding Personal Data in Telecommunications

Role of Enhanced Access Controls in Safeguarding Personal Data in Telecommunications that every Organisation in…

6 days ago

Role of Effective Incident Response Procedures in Strengthening Data Security

Effective Incident Response Procedures in Strengthening Data Security that every Organisation in Singapore should know…

7 days ago

Strengthening Your Cyber Defenses: The Crucial Role of Regular Vulnerability Scanning

Crucial Role of Regular Vulnerability Scanning that every Organisation in Singapore should know. Strengthening Your…

1 week ago

Enhancing Data Security with Multi-Factor Authentication

Enhancing Data Security with Multi-Factor Authentication that every Organisation in Singapore should know. Enhancing Data…

2 weeks ago

A Strong Password Policy: Your Organization’s First Line of Defense Against Data Breaches

Strong Password Policy as a first line of defense against data breaches for Organisations in…

2 weeks ago

Enhancing Website Security: The Importance of Efficient Access Controls

Importance of Efficient Access Controls that every Organisation in Singapore should take note of. Enhancing…

3 weeks ago