lodash.defaultsdeep prototype pollution

Severity: info · Published 2020-09-03

lodash.defaultsdeep is a JavaScript utility library function commonly used in Node.js applications to merge configuration objects. The vulnerability allows an attacker to inject malicious properties into JavaScript's Object prototype, causing unexpected behavior or bypasses in security checks across an entire application. This could lead to application logic errors or privilege escalation depending on how the affected code uses object properties.

Technologies: lodash.defaultsdeep (npm). Vendors: npm.

Quick answers

Is This vulnerability exploited in the wild?
No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.
How severe is This vulnerability?
Informational severity, published 3 September 2020.
Which products and versions are affected?
lodash.defaultsdeep (npm) SEMVER:introduced=0,fixed=4.6.1.
Is there a fix for This vulnerability?
Yes. lodash.defaultsdeep (npm): upgrade to 4.6.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is This vulnerability attacked?
It is attacked with local access, in a software library.
Am I affected?
Check whether you run lodash.defaultsdeep (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • lodash.defaultsdeep (npm): upgrade to 4.6.1 or later
    npm install lodash.defaultsdeep@4.6.1

Technical details

The vulnerability is a prototype pollution flaw in the defaultsDeep function (CWE-1321). When processing deeply nested objects, the function fails to sanitize the __proto__ property, allowing attackers to modify Object.prototype through specially crafted input objects. The attack vector is local/application-level: an attacker must control the input object structure passed to defaultsDeep, typically through JSON deserialization or user-supplied configuration. This can affect all objects created after the pollution occurs. The fix is available in version 4.6.1 and later.

Affected products

  • npm lodash.defaultsdeep < 4.6.1

Timeline

  • 2020-09-03: disclosed

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.