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.
- 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.
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
- Load the property-expr module.
- Create an empty object.
- Call the setter with a path that goes through constructor and prototype to set a property.
- 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.