Prototype Pollution in lodash.defaultsdeep

lodash.defaultsdeep Updated 02 Oct 2025

Summary

03/09/2020
HIGH
Yes i
High
Not published

GHSA-46fh-8fc5-xcwx: Prototype Pollution in lodash.defaultsdeep. Affects lodash.defaultsdeep versions < 4.6.1. Fixed in 4.6.1. How to fix ↓

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

The package 'lodash.defaultsdeep' is an npm package that provides a utility function called 'defaultsDeep'. This function is used to merge the properties of multiple objects into a single object, with the values from the later objects overwriting the values from the earlier ones. It is commonly used in JavaScript applications to set default values for configuration objects or to merge user-provided options with default options.

However, versions of 'lodash.defaultsdeep' before 4.6.1 are vulnerable to Prototype Pollution. This vulnerability allows a malicious user to modify the prototype of the 'Object' via the 'proto' property, leading to the addition or modification of an existing property that will exist on all objects. This can result in unexpected behavior or security issues in applications that use 'lodash.defaultsdeep'.

Vulnerability Detail

The vulnerability in 'lodash.defaultsdeep' arises from the function's failure to properly sanitize user input. By manipulating the 'proto' property, an attacker can pollute the prototype of 'Object' and introduce or modify properties that will be present in all objects. This can lead to various security issues, such as privilege escalation, remote code execution, or data tampering.

The impact of this vulnerability depends on how the affected package is used within an application. If the package is used in a critical context where the modified prototype can be abused, the consequences can be severe. It is important to note that this vulnerability can only be exploited if untrusted user input is passed to the 'defaultsDeep' function.

How To Fix

Minimum fixed version

4.6.1

This is the first release that contains the fix.

npm install lodash.defaultsdeep@4.6.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating 'lodash.defaultsdeep' is not immediately feasible, a temporary workaround can be implemented by manually sanitizing the input before passing it to the 'defaultsDeep' function. This can be done by validating and filtering the input to ensure that it does not contain any malicious or unexpected values. Here is an example of how this can be achieved in JavaScript:

const lodash = require('lodash.defaultsdeep');

function sanitizeInput(input) {
  // Perform input validation and filtering here
  // to prevent prototype pollution
  return input;
}

const sanitizedInput = sanitizeInput(userInput);
const mergedObject = lodash.defaultsDeep({}, sanitizedInput);

Conclusion

In conclusion, the 'lodash.defaultsdeep' package versions prior to 4.6.1 are vulnerable to Prototype Pollution. This vulnerability allows an attacker to modify the prototype of 'Object' via the 'proto' property, potentially leading to security issues or unexpected behavior. It is crucial to update the package to the latest version or implement a temporary workaround to mitigate the risk. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for lodash.defaultsdeep →

Share this vulnerability

FAQ

'lodash.defaultsdeep' is an npm package that provides a utility function called 'defaultsDeep'. It is used to merge the properties of multiple objects into a single object, with the values from the later objects overwriting the values from the earlier ones.

Prototype Pollution is a vulnerability that occurs when a JavaScript application allows the modification of the prototype of an object. This can lead to unexpected behavior or security issues, as the modified prototype affects all instances of the object.

The vulnerability in 'lodash.defaultsdeep' allows a malicious user to modify the prototype of the 'Object' via the 'proto' property. This can result in the addition or modification of properties that will exist on all objects, leading to potential security issues.

The consequences of this vulnerability depend on how the affected package is used within an application. Possible consequences include privilege escalation, remote code execution, or data tampering if the modified prototype is abused in a critical context.

To fix this vulnerability, it is recommended to update 'lodash.defaultsdeep' to version 4.6.1 or later. This version includes a fix that properly sanitizes user input and prevents prototype pollution. Updating the package eliminates the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for lodash.defaultsdeep.

How To Fix

Minimum fixed version

4.6.1

This is the first release that contains the fix.

npm install lodash.defaultsdeep@4.6.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback