Snyk discovers prototype pollution security vulnerabilities affecting lodash
The lodash function defaultsDeep could be tricked into adding or modifying properties of Object.prototype using a constructor payload. An attacker could potentially achieve property injection, code injection, or denial of service depending on the use-case.
snyk.io
Published on snyk.io
On July 2nd, 2019, Snyk published a high severity prototype pollution security vulnerability (CVE-2019-10744) affecting all versions of lodash, as the result of an on-going analysis lead by the Snyk security research team.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely, the defaultsDeep function performed an unsafe recursive merge that did not block keys like 'constructor' and 'prototype', allowing modification of Object.prototype.
Impact
Depending on how the vulnerable function is used, an attacker could inject properties, inject code, or cause denial of service.
What the attacker needed
Application uses lodash defaultsDeep; attacker can supply crafted JSON input
The fix
The fix adds a safety check to prevent polluting the global object via a 'constructor' key, and lodash version 4.17.12 includes the fix.
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 write-up 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 fundamental JavaScript object that many other objects inherit from. This can break the application or, in some cases, let the attacker run their own code. Here, a lodash function that merges objects deeply allowed such changes.
What is Prototype pollution?
Input changes JavaScript's shared object prototype, altering behaviour across the application, sometimes to XSS or code execution.