CVE-2020-7609: Code Injection in node-rules
Summary
CVE-2020-7609: Code Injection in node-rules. Affects node-rules versions >= 3.0.0, < 5.0.0. Fixed in 5.0.0. 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
node-rules is an npm package that provides a rule engine for JavaScript applications. It allows users to define and execute rules based on JSON data. However, versions 3.0.0 and prior to 5.0.0 of node-rules are vulnerable to code injection. The 'fromJSON()' function in node-rules does not properly sanitize the 'rules' argument, allowing users to inject arbitrary commands.
Vulnerability Detail
The code injection vulnerability in node-rules can be exploited by attackers to execute arbitrary commands on the affected system. By manipulating the 'rules' argument of the 'fromJSON()' function, an attacker can inject malicious code that will be executed during rule execution. This can lead to various security risks, including unauthorized access, data breaches, and remote code execution.
How To Fix
Latest published version: 9.2.0 as of 23 Oct 2026
npm install node-rules@9.2.0
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
5.0.0
This is the first release that contains the fix.
npm install node-rules@5.0.0
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 temporary workaround is to manually sanitize the 'rules' argument before passing it to the 'fromJSON()' function. This can be done by implementing input validation and filtering techniques to ensure that only trusted and safe JSON data is processed.
Conclusion
In conclusion, the code injection vulnerability in node-rules can be a serious security risk, allowing attackers to execute arbitrary commands. It is crucial to upgrade to the latest version of node-rules or implement proper input validation to mitigate this vulnerability. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for node-rules →
FAQ
node-rules is an npm package that provides a rule engine for JavaScript applications. It allows users to define and execute rules based on JSON data.
Versions 3.0.0 and prior to 5.0.0 of node-rules are affected by this code injection vulnerability.
This vulnerability allows attackers to execute arbitrary commands on the affected system, potentially leading to unauthorized access, data breaches, and remote code execution.
To fix this vulnerability, it is recommended to upgrade to version 5.0.0 or later of node-rules. Alternatively, you can manually sanitize the 'rules' argument before passing it to the 'fromJSON()' function.
Yes, a temporary workaround is to implement input validation and filtering techniques to sanitize the 'rules' argument before using it in the 'fromJSON()' function.
References
Related vulnerabilities
Recent vulnerabilities recorded for node-rules.