CVE-2018-3721: Prototype Pollution in lodash
Summary
CVE-2018-3721: Prototype Pollution in lodash. Affects lodash versions < 4.17.5. Fixed in 4.17.5. How to fix ↓
Also tracked for
- node-lodash · Debian:11
The same CVE-2018-3721 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
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 lodash package is a popular utility library for JavaScript that provides helpful functions for manipulating and working with arrays, objects, and other data types. It is widely used in various applications and frameworks. However, versions of lodash before 4.17.5 are vulnerable to a security issue known as prototype pollution.
Vulnerability Detail
Prototype pollution is a vulnerability that allows an attacker to modify the prototype of an object, leading to the addition or modification of properties that will exist on all objects. In the case of lodash, the vulnerable functions 'defaultsDeep', 'merge', and 'mergeWith' can be exploited by a malicious user to modify the prototype of the Object via the __proto__ property. This can have serious consequences, as it allows the attacker to manipulate the behavior of the affected application and potentially execute arbitrary code.
How To Fix
Latest published version: 4.18.1 as of 22 Oct 2026
npm install lodash@4.18.1
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
4.17.5
This is the first release that contains the fix.
npm install lodash@4.17.5
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you are unable to immediately update to the fixed version of lodash, you can implement a workaround by manually checking and sanitizing any user-supplied data before using the vulnerable functions. This involves validating and filtering the input to ensure it does not contain any malicious or unexpected values. Here's an example of how you can sanitize the input using a custom function:
function sanitizeInput(data) {
if (typeof data === 'object' && !Array.isArray(data)) {
// Perform deep sanitization of the object
// Remove any potentially harmful properties
// Return the sanitized object
}
return data;
}
Conclusion
Prototype pollution in lodash (CVE-2018-3721) is a serious vulnerability that allows an attacker to modify the prototype of an object, leading to potential code execution and manipulation of the affected application. It is crucial to update the lodash package to version 4.17.5 or later to mitigate this risk. If immediate update is not possible, implementing input sanitization can serve as a temporary workaround. For further support and assistance in vulnerability remediation, you can reach out to DevNack.com.
See every vulnerability recorded for lodash →
FAQ
Prototype pollution is a vulnerability that allows an attacker to modify the prototype of an object, leading to the addition or modification of properties that will exist on all objects. This can have serious consequences, as it allows the attacker to manipulate the behavior of the affected application and potentially execute arbitrary code.
Versions of lodash before 4.17.5 are affected by this vulnerability. It is recommended to update to version 4.17.5 or later to mitigate the risk.
You can update the lodash package by running the following command in your project's root directory: npm install lodash@4.17.5.
If you are unable to immediately update to the fixed version of lodash, you can implement a workaround by manually checking and sanitizing any user-supplied data before using the vulnerable functions. This involves validating and filtering the input to ensure it does not contain any malicious or unexpected values.
You can find more information about this vulnerability in the official advisory published by the GitHub Security Advisory Database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/07/GHSA-fvqr-27wr-82fm/GHSA-fvqr-27wr-82fm.json
Related vulnerabilities
Recent vulnerabilities recorded for lodash.