CVE-2018-3751: Prototype Pollution in merge-recursive

merge-recursive Updated 02 Oct 2025

Summary

18/09/2018
No i
Critical
9.8

CVE-2018-3751: Prototype Pollution in merge-recursive. Affects merge-recursive versions < 0.0.3. No fix is published. 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 Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The merge-recursive package is an npm package used for merging JavaScript objects recursively. It provides a function called merge that takes two objects as input and merges them together. This package is vulnerable to Prototype Pollution, a type of vulnerability where an attacker can modify the prototype of an object by injecting malicious input. This vulnerability affects all versions of merge-recursive.

Vulnerability Detail

Prototype Pollution allows an attacker to modify the prototype of an object via the __proto__ property. In the case of merge-recursive, when malicious user input is merged with another object, it can lead to the addition or modification of existing properties. This can have severe consequences, as it allows an attacker to manipulate the behavior of the affected code and potentially execute arbitrary code. An example proof of concept code is provided in the vulnerability details.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. Scan free →

Workaround

As there is no fix available, a workaround for this vulnerability is to manually sanitize and validate the input before merging it with other objects. This can involve checking the properties and values of the input object to ensure they are safe and do not contain any malicious code. Here is an example of how to sanitize the input object before merging:

var merge = require('merge-recursive').recursive;
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';

var a = {};
console.log("Before : " + a.oops);

// Sanitize the input object
var sanitized_payload = JSON.parse(malicious_payload);
if (typeof sanitized_payload === 'object' && sanitized_payload !== null) {
  delete sanitized_payload.__proto__;
}

merge({}, sanitized_payload);
console.log("After : " + a.oops);

This code snippet demonstrates how to remove the __proto__ property from the input object before merging it, effectively mitigating the Prototype Pollution vulnerability.

Conclusion

The merge-recursive package is vulnerable to Prototype Pollution, allowing an attacker to modify the prototype of an object via the __proto__ property. This can lead to the addition or modification of existing properties, potentially resulting in code execution or unexpected behavior. Currently, there is no fix available for this vulnerability. It is recommended to avoid using the merge-recursive package until a fix is provided. Manually sanitizing and validating the input before merging can help mitigate the risk of this vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for merge-recursive →

Share this vulnerability

FAQ

Prototype Pollution is a vulnerability that allows an attacker to modify the prototype of an object, leading to unexpected behavior and potential code execution. It occurs when user input is not properly sanitized and is used to modify the properties or behavior of an object.

In merge-recursive, when malicious user input is merged with another object, it can modify the prototype of the resulting object via the __proto__ property. This allows an attacker to add or modify properties of the object, potentially leading to code execution or unexpected behavior.

Yes, all versions of merge-recursive are vulnerable to Prototype Pollution. It is recommended to avoid using this package until a fix is provided.

Currently, there is no fix available for this vulnerability. It is advised to follow the recommended workaround or consider using an alternative package for object merging.

To mitigate the risk of Prototype Pollution in merge-recursive, it is recommended to manually sanitize and validate the input before merging it with other objects. This involves checking the properties and values of the input object to ensure they are safe and do not contain any malicious code.

How To Fix

No fixed version is published for this vulnerability.

Tip — Not sure whether your app is affected? Vulert can check the versions your app actually runs. 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