Describe the bug
Prototype Pollution
Affecting property-expr package, versions <2.0.3
property-expr is a tiny util for getting and setting deep object props safely
Affected versions of this package are vulnerable to Prototype Pollution via the setter function.
POC
var expr = require('property-expr');
expr.setter('__proto__.polluted')({}, true);
console.log(polluted); // true
Details:
Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as __proto__, constructor and prototype. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on the Object.prototype are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.
There are two main ways in which the pollution of prototypes occurs:
Unsafe Object recursive merge
Property definition by path
How to fix?
Upgrade property-expr to version 2.0.3 or higher.
Describe the bug Prototype Pollution Affecting property-expr package, versions <2.0.3
property-expr is a tiny util for getting and setting deep object props safely
Affected versions of this package are vulnerable to Prototype Pollution via the setter function.
POC
Details: Prototype Pollution is a vulnerability affecting JavaScript. Prototype Pollution refers to the ability to inject properties into existing JavaScript language construct prototypes, such as objects. JavaScript allows all Object attributes to be altered, including their magical attributes such as
__proto__
,constructor
andprototype
. An attacker manipulates these attributes to overwrite, or pollute, a JavaScript application object prototype of the base object by injecting other values. Properties on theObject.prototype
are then inherited by all the JavaScript objects through the prototype chain. When that happens, this leads to either denial of service by triggering JavaScript exceptions, or it tampers with the application source code to force the code path that the attacker injects, thereby leading to remote code execution.There are two main ways in which the pollution of prototypes occurs:
How to fix? Upgrade property-expr to version 2.0.3 or higher.
Reference: https://security.snyk.io/vuln/SNYK-JS-PROPERTYEXPR-598800