Skip to content
Prototype pollution Disclosed report Beginner

property-expr - Prototype pollution

The property-expr library's setter function can be tricked into modifying the Object prototype by using a path like 'constructor.prototype.isAdmin'. An attacker could then set arbitrary properties on all objects, potentially leading to denial of service, remote code execution, or altered logic flow.

ahihi Follow

Originally disclosed on HackerOne

High 7.3 View original
  • Fixed in 2 months
  • Disclosed after 3 months

I would like to report Prototype pollution in property-expr It allows attacker to modify the prototype of a base object.

Module

module name: property-expr version: 2.0.2 npm page: https://www.npmjs.com/package/property-expr

Module Description

Tiny property path utilities, including path parsing and metadata and deep property setters and getters

Module Stats

Replace stats below with numbers from npm’s module page:

[1,057,612] weekly downloads

Vulnerability

Vulnerability Description

The functions setter can be tricked into modifying properties of the Object prototype. These properties will be present on all objects.

Steps To Reproduce:

Run the following code:

let expr = require('property-expr')
obj = {}
expr.setter('constructor.prototype.isAdmin')(obj,true)
console.log({}.isAdmin) // true

Wrap up

Select Y or N for the following statements:

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

Impact

Modify Object prototype can lead to Dos, RCE, change code logic flow.

The original report as published on HackerOne, by ahihi. 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 setter function does not block path segments like 'constructor' and 'prototype', allowing traversal to the Object prototype.

Impact

Modifying the Object prototype could lead to denial of service, remote code execution, or changes in code logic flow.

What the attacker needed

Attacker can control the property path passed to setter

How it was found

  1. Load the property-expr module.
  2. Create an empty object.
  3. Call the setter with a path that goes through constructor and prototype to set a property.
  4. Observe that the property appears on a new empty object.

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 flaw where an attacker can add or change properties on a base object that many other objects inherit from. In JavaScript, the Object prototype is like a shared template; if you modify it, every object gets the change. Here, a library function that sets deep properties can be tricked into reaching that shared template, letting an attacker set values that affect the whole program.

What is Prototype pollution?

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

More by ahihi

View all

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