CVE-2020-7785: Command injection in node-ps

node-ps Updated 02 Oct 2025

Summary

19/03/2021
No i
Critical
9.8

CVE-2020-7785: Command injection in node-ps. Affects node-ps versions < 0.0.2. No fix is published. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

The package under scrutiny is node-ps, an npm package. It provides functionality for executing system commands and retrieving information about running processes in a Node.js environment. The vulnerability affects all versions of the package. It is important to note that the injection point is located in line 72 of the lib/index.js file.

Vulnerability Detail

The vulnerability in node-ps is a command injection vulnerability. This means that an attacker can manipulate user input to execute arbitrary commands on the system. The injection point in line 72 of lib/index.js allows an attacker to inject malicious commands, potentially leading to unauthorized access, data leakage, or remote code execution. This vulnerability has a CVSS score of 9.8, indicating its critical severity.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

If updating the package is not immediately feasible, a temporary workaround can be implemented by sanitizing user input and ensuring that any command execution is properly validated and restricted. Here is an example of how to sanitize user input in Node.js:

const { exec } = require('child_process');

function executeCommand(command) {
  const sanitizedCommand = command.replace(/[&|;$`\<>]/g, '');
  exec(sanitizedCommand, (error, stdout, stderr) => {
    // Handle command execution results
  });
}

Conclusion

In conclusion, the node-ps package is vulnerable to a command injection vulnerability that allows attackers to execute arbitrary commands on the system. It is crucial to update the package to a secure version or implement the provided workaround to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for node-ps →

Share this vulnerability

FAQ

Node-ps is an npm package that provides functionality for executing system commands and retrieving information about running processes in a Node.js environment.

A command injection vulnerability allows an attacker to manipulate user input to execute arbitrary commands on the system, potentially leading to unauthorized access, data leakage, or remote code execution.

This vulnerability in node-ps can allow an attacker to execute arbitrary commands on the system, potentially leading to unauthorized access, data leakage, or remote code execution.

To fix this vulnerability, it is recommended to update the node-ps package to a version that includes a patch for the command injection issue. The package maintainers have addressed this vulnerability in version 0.0.3 and later. Users should update their package dependencies to the latest secure version.

If updating the package is not immediately feasible, a temporary workaround can be implemented by sanitizing user input and ensuring that any command execution is properly validated and restricted.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback