Improper Privilege Management in shelljs
Summary
GHSA-64g7-mvw6-v9qj: Improper Privilege Management in shelljs. Affects shelljs versions < 0.8.5. Fixed in 0.8.5. 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
ShellJS is a portable Unix shell commands for Node.js that provides a simple and consistent interface for executing shell commands. It is commonly used for automating tasks and interacting with the command line. However, a vulnerability has been discovered in the shell.exec() function, which can lead to improper privilege management.
Vulnerability Detail
The vulnerability arises from the synchronous version of shell.exec(), which may expose output to other users on the same system. This can occur in multi-user Mac, Linux, or WSL environments, as well as when executing shell.exec() as the root user. Other functions in ShellJS are not affected. The impact of this vulnerability is that sensitive information may be visible to unauthorized users, potentially leading to unauthorized access or data leakage.
How To Fix
Minimum fixed version
0.8.5
This is the first release that contains the fix.
npm install shelljs@0.8.5
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not immediately feasible, a workaround is to avoid using the synchronous version of shell.exec(). Instead, you can use the asynchronous version or consider alternative approaches for executing shell commands. Here is an example of using the asynchronous version of shell.exec():
const shell = require('shelljs');
shell.exec('command', { async: true }, (code, stdout, stderr) => {
// Handle the command output
});
Conclusion
The improper privilege management vulnerability in shelljs can lead to unauthorized access or data leakage. It is recommended to upgrade to shelljs version 0.8.5 or later to mitigate this issue. If immediate upgrade is not possible, using the asynchronous version of shell.exec() or exploring alternative approaches for executing shell commands can serve as a workaround. For further support on vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for shelljs →
FAQ
The vulnerability allows other users on the same system to potentially view sensitive information, leading to unauthorized access or data leakage.
The vulnerability affects ShellJS versions prior to 0.8.5.
There are currently no known exploits for this vulnerability.
No, this vulnerability can only be exploited by users on the same system.
No, there is no CVE assigned to this vulnerability at the moment.
References
Related vulnerabilities
Recent vulnerabilities recorded for shelljs.