Skip to content
Prototype pollution Disclosed report Beginner

Prototype pollution attack (upmerge)

The upmerge library merges attacker-controlled JSON into objects without guarding the special __proto__ key, so a crafted payload adds properties to Object.prototype. Any object in the process then inherits the injected property, which the reporter says can lead to denial of service or, in some cases, remote code execution.

dienpv Follow

Originally disclosed on HackerOne

Medium 5.0 View original
  • Triaged in 5 days
  • Fixed in 3 months
  • Disclosed after 3 months

Hi team, I would like to report a prototype pollution vulnerability in upmerge that allows an attacker to inject properties on Object.prototype.

Module

module name: upmerge version: 0.1.7 npm page: https://www.npmjs.com/package/upmerge

Module Description

JavaScript Object Merge and Clone for Client or Server side

Vulnerability

Vulnerability Description

this vulnerability type is similar to my report #438274 upmerge is vulnerable to prototype pollution when it merges objects.

Steps To Reproduce:

In the following code snippet, "payload" would come from user-input (JSON data).

JavaScript
var upmerge = require('upmerge');
var payload = '{"__proto__":{"polluted":"upmerge_done !"}}';
var test = {};
console.log("Before: ", test.polluted);
upmerge.merge({},JSON.parse(payload));
console.log("After: ", test.polluted);

# Wrap up

- I contacted the maintainer to let them know: N
- I opened an issue in the related repository: N

Thanks!

## Impact

It causes Denial of Service or RCE in some cases.

The original report as published on HackerOne, by dienpv. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

The reporter states it causes denial of service or RCE in some cases, though the demonstration only shows a property appearing on an unrelated object.

What the attacker needed

Attacker-controlled JSON passed to merge; application uses the upmerge package

How it was found

  1. Load the upmerge module and prepare a JSON payload containing a __proto__ key.
  2. Create a plain test object and check that the chosen property is undefined.
  3. Merge an empty object with the parsed payload using upmerge.merge.
  4. Check the test object again and observe the injected property now present.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

JavaScript objects inherit shared defaults from a built-in object called Object.prototype. If a library copies user-supplied keys into an object without blocking the special key __proto__, an attacker can add their own defaults that every object in the program then sees. That can break the application or, in some situations, be turned into code execution.

What is Prototype pollution?

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.

More by dienpv

View all

4 more disclosed reports, best first.

More from Node.js third-party modules

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Prototype pollution

The lesson behind this report.

Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.