Heavily Used Node.js Package Has A Code Injection Vulnerability

Heavily Used Node.js Package Has A Code Injection Vulnerability

A heavily downloaded Node.js library has a high severity command injection vulnerability revealed this month.

Tracked as CVE-2021-21315, the bug impacts the “systeminformation” npm component which gets about 800,000 weekly downloads and has scored close to 34 million downloads to date since its inception.

OS Command Injection bug squashed

Put simply, “systeminformation” is a lightweight Node.js library that developers can include in their project to retrieve system information related to CPU, hardware, battery, network, services, and system processes.

According to the project’s developer, developers are expected to use “systeminformation” in the backend.

“Node.js comes with some basic OS information, but I always wanted a little more. So I came up to write this little library.”

“This library is still work in progress. It is supposed to be used as a backend/server-side library (will definitely not work within a browser),” states the developer behind the component.

However, the presence of the code injection flaw within “systeminformation” meant an attacker could execute system commands by carefully injecting payload within the unsanitized parameters used by the component.

The fix shown below that went into version 5.3.1 of “systeminformation” sanitizes the parameters, checks if they are of the string data type and additionally whether prototype pollution had occurred at any point by the parameter, prior to invoking further commands.

Also Read: A Look at the Risk Assessment Form Singapore Government Requires

Fix for CVE-2021-21315 sanitizes and validates the parameters properly
Source: GitHub

​​​​​​

Users of “systeminformation” should upgrade to versions 5.3.1 and above to resolve the CVE-2021-21315 vulnerability in their application.

Workaround also available

For developers who are unable to upgrade to the fixed version, the project publisher has shared information on a workaround that can be adopted instead.

This again involves cleaning up the parameters for any offending characters and properly validating if they are of the string data type.

“As a workaround instead of upgrading, be sure to check or sanitize service parameters that are passed to si.inetLatency()si.inetChecksite()si.services()si.processLoad() … do only allow strings, reject any arrays. String sanitation works as expected,” reads the associated npm security advisory.

Node.js developers are encouraged to ensure if their applications properly sanitize user input prior to using it within commands and database queries.

Also Read: How to Send Mass Email Without Showing Addresses: 2 Great Workarounds

Users should also periodically visit npm security advisories for information on the latest security fixes made to Node.js components.

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…

1 week 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…

2 weeks 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…

2 weeks ago

Enhancing Data Security with Multi-Factor Authentication

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

3 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…

3 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…

4 weeks ago