Skip to content
Prototype pollution Disclosed report Intermediate

Prototype Pollution lodash 4.17.15

The lodash functions setWith and set allow an attacker to add properties to the global Object.prototype by using a crafted path. This can cause a denial of service and may let an attacker control sensitive variables in an application.

awarau Follow

Originally disclosed on HackerOne

  • Triaged in 44 hours
  • Fixed in 3 months
  • Paid in 3 months
  • Disclosed after 4 months

I would like to report Prototype Pollution in lodash version 4.17.15 It allows Denial of Service and more.

Module

module name: lodash version: 4.17.15 npm page: https://www.npmjs.com/package/lodash

Module Description

The Lodash library exported as Node.js modules.

Module Stats

27M in the last week

Vulnerability

Vulnerability Description

Steps To Reproduce:

  1. Create a JS file with this contents:

lod = require('lodash') lod.setWith({}, "proto[test]", "123") lod.set({}, "proto[test2]", "456") console.log(test) console.log(test2)

  1. Execute it with node
  2. Observe that test and test2 are now on the Object.prototype.

Supporting Material/References:

This is a variation on: https://hackerone.com/reports/380873

Wrap up

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

Impact

test and test2 could just have easily been toString(). This would allow an attacker to cause a denial of service as all objects inherit from the Object.prototype. Additionally, if there are sensitive variables and attributes in a particular application, these can be controlled via the prototype.

The original report as published on HackerOne, by awarau. 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 library does not block the special __proto__ key when setting nested properties, so it writes directly onto Object.prototype.

Impact

An attacker could cause a denial of service, and if the application has sensitive variables, they could be controlled through the prototype.

What the attacker needed

Application uses lodash set or setWith; attacker can control the path argument

How it was found

  1. Create a JavaScript file that requires lodash and calls setWith and set with a path containing __proto__.
  2. Run the file with Node.js.
  3. Check that the new properties appear on Object.prototype.

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 bug where an attacker can add or change properties on a base object that many other objects inherit from. In JavaScript, almost every object inherits from Object.prototype, so polluting it can break the whole application or let an attacker influence how it behaves.

What is Prototype pollution?

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

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.