Skip to content
Prototype pollution Disclosed report Beginner

[object-path-set] Prototype pollution

The object-path-set module allows an attacker to set properties on Object.prototype via a path like __proto__.polluted. This prototype pollution could lead to denial of service, remote code execution, or property injection depending on the application.

d3lla Follow

Originally disclosed on HackerOne

  • Triaged in 4 hours
  • Fixed in 2 months
  • Disclosed after 3 months

I would like to report a prototype pollution vulnerability in object-path-set module. It allows an attacker to inject properties on Object.prototype.

Module

module name: object-path-set version: 1.0.0 npm page: https://www.npmjs.com/package/object-path-set

Module Description

set values in javascript objects by specifying a path. if the path doesn't exist yet, it will be created.

Module Stats

[81] weekly downloads

Vulnerability

Vulnerability Description

The setPath function can be used to add/modify properties of the Object prototype. These properties will be present on all objects.

Steps To Reproduce:

  • install object-path-set module:
    • npm i object-path-set

Set the __proto__.polluted property of an object:

JavaScript

const setPath = require('object-path-set');
const obj = {};
console.log("Before : " + obj.polluted);
setPath({}, '__proto__.polluted', 'yes');
console.log("After : " + obj.polluted);

Output:

CONSOLE

Before : undefined
After : yes
object-path-set_poc.mov From the original on HackerOne

Supporting Material/References:

  • OPERATING SYSTEM VERSION: Ubuntu 18.04.4 LTS
  • NODEJS VERSION: v14.1.0
  • NPM VERSION: 6.14.5

Wrap up

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

Thank you for your time.

best regards,

d3lla

Impact

The impact depends on the application. In some cases it is possible to achieve Denial of service (DoS), Remote Code Execution, Property Injection.

The original report as published on HackerOne, by d3lla. 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

Root cause

Likely the setPath function does not block or sanitise special path segments such as __proto__, constructor, or prototype, allowing assignment to Object.prototype.

Impact

The impact depends on the application; in some cases it is possible to achieve denial of service, remote code execution, or property injection.

What the attacker needed

Application uses object-path-set with user-controlled paths

How it was found

  1. Install the object-path-set module.
  2. Create an empty object and check that a property like polluted is undefined.
  3. Call setPath with an empty object, a path containing __proto__.polluted, and a value.
  4. Check the original empty object again and see that the property now exists.

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.

Prototype pollution is a JavaScript bug where an attacker can add or change properties on the base object that all other objects inherit from. This means every object in the program suddenly gets that property, which can break logic or even let an attacker run code. Here, a library that sets nested values by path did not block special path parts like __proto__.

What is Prototype pollution?

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

More by d3lla

View all

16 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.