Prototype pollution attack in node.extend
State Resolved (Closed)
Disclosed publicly 2018-11-30T14:01:57.458Z
Reported To
Weakness Denial of Service
Bounty
Collapse


Timeline
submitted a report to Node.js third-party modules .
2018-10-30T11:42:18.593Z

I would like to report a prototype pollution vulnerability in node.extend.
It allows an attacker to inject properties on Object.prototype.

Module

module name: node.extend
version: 2.0.0
npm page: https://www.npmjs.com/package/node.extend

Module Description

A port of jQuery.extend that actually works on node.js

Module Stats

267,701 downloads in the last week

Vulnerability

Vulnerability Description

This is a variant of this vulnerability:
https://hackerone.com/reports/310443

node.extend can be tricked into adding or modifying properties of the Object prototype. These properties will be present on all objects.

Steps To Reproduce:

Craft an object of form {__proto__: {...}} and send it to node.extend:

let extend = require('node.extend');
extend(true, {}, JSON.parse('{"__proto__": {"isAdmin": true}}'));
console.log({}.isAdmin); // true

Wrap up

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

Impact

Denial of service, possibly more depending on the application.
See https://hackerone.com/reports/310443

Regards,
Frans

  • 0 attachments:
e_lexy Activities::BugTriaged
2018-10-30T12:43:43.464Z
HiĀ <HACKER>, Thanks for reporting this issue. I was able to reproduce and confirm the issue as you described and will triage this report as vulnerability. I will invite the package maintainer to this issue. Alex


ljharb Activities::ExternalUserJoined
2018-10-30T22:52:21.521Z


ljharb Activities::Comment
2018-10-30T23:20:24.249Z
This is also the same as https://hackerone.com/reports/381185


ljharb Activities::Comment
2018-10-31T00:31:19.048Z
I've released a fix in v2.0.1 and backported it to v1.1.7; hopefully that's sufficient to close this issue :-)


e_lexy Activities::Comment
2018-10-31T06:26:25.650Z
Thanks @ljharb for your super quick patch! I can confirm it works for me in 2.0.1 and 1.1.7. @asgerf when you can confirm this is fixed in 2.0.1 and 1.1.7 I will move to resolve and disclose.


asgerf Activities::Comment
2018-10-31T13:59:14.778Z
Can also confirm the fix in 2.0.1 and 1.1.7. Thanks for the quick fix.


e_lexy Activities::BugResolved
2018-10-31T14:01:17.900Z
Confirmed, closing this one.


e_lexy Activities::AgreedOnGoingPublic
2018-10-31T14:01:47.914Z
Versions 2.0.1 and 1.1.7 fix this issue.


Activities::ReportBecamePublic
2018-11-30T14:01:57.506Z