Critical Type Confusion Vulnerability in node-set-value Package
Summary
CVE-2021-23440: This affects the package set-value before =3.0.0. Affects node-set-value across 2 version ranges.
< 3.0.1-2+deb11u1
< 7cf8073bb06bf0c15e08475f9f952823b4576452
Fixed in 3.0.1-2+deb11u1. 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 node-set-value package is a utility for setting values in JavaScript objects, allowing developers to easily manipulate object properties. It is widely used in various applications for its simplicity and effectiveness. However, certain versions of this package are vulnerable to a type confusion issue that can lead to security breaches, particularly when user-provided keys are used improperly.
Vulnerability Detail
This vulnerability, identified as CVE-2021-23440, affects the node-set-value package versions before 2.0.1 and between 3.0.0 and 4.0.1. It arises from a type confusion flaw that can allow attackers to bypass the protections established by CVE-2019-10747. The issue occurs when user-provided keys in the path parameter are treated as arrays, potentially leading to unauthorized access or manipulation of data. The severity of this vulnerability is underscored by its CVSS score of 9.8, indicating a critical risk to applications utilizing affected versions of the package.
How To Fix
Minimum fixed version
3.0.1-2+deb11u1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade node-set-value
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If immediate upgrading is not feasible, consider implementing input validation to sanitize user-provided keys before they are processed by the node-set-value function. This can help mitigate the risk of type confusion. Example code:
function safeSetValue(obj, path, value) {
if (Array.isArray(path)) {
throw new Error('Invalid path: arrays are not allowed.');
}
setValue(obj, path, value);
}
Conclusion
The CVE-2021-23440 vulnerability in the node-set-value package poses a significant risk to applications that utilize affected versions. It is crucial to upgrade to a secure version to mitigate potential security threats. Additionally, implementing input validation can serve as a temporary measure to protect against this vulnerability.
See every vulnerability recorded for node-set-value →
FAQ
CVE-2021-23440 is a critical vulnerability in the node-set-value package that allows for type confusion, potentially leading to unauthorized data access.
The vulnerability affects node-set-value versions before 2.0.1 and between 3.0.0 and 4.0.1.
You can use the Vulert platform to monitor and alert for open-source vulnerabilities in your software by analyzing your manifest file, such as package-lock.json.
The CVSS score for CVE-2021-23440 is 9.8, indicating a critical level of risk.
Implement input validation to sanitize user-provided keys as a temporary workaround until you can upgrade to a secure version.
Related vulnerabilities
Recent vulnerabilities recorded for node-set-value.