Command Injection in command-exists
Summary
GHSA-cff4-rrq6-h78w: Command Injection in command-exists. Affects command-exists versions < 1.2.4. Fixed in 1.2.4. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
The command-exists package is an npm module that checks if a command exists on the system. It is commonly used in Node.js applications to verify the availability of specific commands before executing them. However, versions prior to 1.2.4 are vulnerable to command injection if user input is not properly validated or sanitized.
Vulnerability Detail
The vulnerability in command-exists allows an attacker to execute arbitrary commands on the system by manipulating user input. This can lead to unauthorized access, data breaches, or even complete compromise of the affected system. The vulnerability is classified as critical (severity level) and is assigned CWE-77.
How To Fix
Latest published version: 1.2.9 as of 22 Oct 2026
npm install command-exists@1.2.9
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
1.2.4
This is the first release that contains the fix.
npm install command-exists@1.2.4
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If updating the package is not immediately feasible, a temporary workaround is to ensure that all user input is properly validated and sanitized before passing it to the command-exists module. This can be achieved by using input validation libraries or implementing strict input filtering.
Conclusion
The command-exists package prior to version 1.2.4 is vulnerable to command injection, which can lead to serious security breaches. It is crucial to update the package to the latest version or apply proper input validation and sanitization to mitigate the risk. For further support on vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for command-exists →
FAQ
The vulnerability allows an attacker to execute arbitrary commands on the system, potentially leading to unauthorized access, data breaches, or complete compromise of the affected system.
You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and the tool will provide real-time alerts for open-source vulnerabilities.
Yes, updating the command-exists package to version 1.2.4 or later will fix this vulnerability. It is recommended to always keep your dependencies up to date to mitigate security risks.
If updating the package is not immediately feasible, you can implement strict input validation and sanitization to prevent command injection attacks. Ensure that all user input is properly validated before passing it to the command-exists module.
You can find more information about this vulnerability in the GitHub Advisory Database. The link to the advisory for this specific vulnerability is provided in the vulnerability details.