Prototype pollution in dot-prop
The dot-prop library allows setting properties on the prototype of a base object via a crafted dot path. An attacker could modify the prototype, potentially leading to denial of service, access to sensitive data, or remote code execution depending on how the library is used.
Originally disclosed on HackerOne
- Triaged in 19 hours
- Fixed in 3 months
- Disclosed after 3 months
I would like to report a parameter pollution in dot-prop It allows an attacker to modify the prototype of a base object which can vary in severity depending on the implementation (DoS, access to sensitive data, RCE).
Module
module name: dot-prop version: 5.1.1 npm page: https://www.npmjs.com/package/dot-prop
Module Description
Get, set, or delete a property from a nested object using a dot path
Module Stats
weekly downloads: 8,627,892
Vulnerability
Vulnerability Description
See previous description
Steps To Reproduce:
var dotProp = require("dot-prop")
const object = {};
console.log("Before " + object.b); //Undefined
dotProp.set(object, '__proto__.b', true);
console.log("After " + {}.b); //true
Wrap up
Select Y or N for the following statements:
- I contacted the maintainer to let them know: N
- I opened an issue in the related repository: N
Impact
Can result in: dos, access to restricted data, rce (depends on implementation)
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 library fails to block special property names like '__proto__' when setting nested properties, allowing modification of the object prototype.
Impact
Depending on how the library is used, this could lead to denial of service, access to restricted data, or remote code execution.
What the attacker needed
Application uses dot-prop to set properties from user input
How it was found
- Require the dot-prop module and create an empty object.
- Use dotProp.set with a path that includes '__proto__' to set a property on the prototype.
- Observe that the property is now accessible on other objects.
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 fundamental JavaScript object that many other objects inherit from. This can break the application or let the attacker influence how it behaves, sometimes leading to serious consequences like running malicious code.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.