lodash.defaultsdeep prototype pollution

Severity: info · Published 2020-09-03

lodash.defaultsdeep is a JavaScript utility library function used to merge configuration objects in applications. A flaw in how it handles deep merging allows attackers to inject properties into JavaScript's Object prototype, potentially affecting all objects in an application and leading to unintended behavior or security bypasses across the codebase.

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 over the network, 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 versions of lodash.defaultsdeep before 4.6.1. The mergeWith function fails to properly sanitize merge operations, allowing attackers to inject malicious properties via specially crafted objects using the {constructor: {prototype: {...}}} pattern. This attack vector does not require authentication and can be triggered if the application uses defaultsdeep to merge untrusted user input with configuration objects. A successful exploit pollutes the Object prototype, causing all objects to inherit the injected properties, potentially enabling property injection attacks, security control bypasses, or denial of service conditions.

Affected products

  • lodash 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.