object-path@0.11.4 vulnerabilities

Access deep object properties using a path

Direct Vulnerabilities

Known vulnerabilities in the object-path package. This does not include vulnerabilities belonging to this package’s dependencies.

Automatically find and fix vulnerabilities affecting your projects. Snyk scans for vulnerabilities and provides fixes for free.
Fix for free
Vulnerability Vulnerable Version
  • H
Prototype Pollution

object-path is a package to access deep properties using a path

Affected versions of this package are vulnerable to Prototype Pollution. A prototype pollution vulnerability exists in del(), empty(), push(), insert() functions when using the "inherited props" mode (e.g. when a new object-path instance is created with the includeInheritedProps option set to true, or when using the withInheritedProps default instance).

To help with preventing this type of vulnerability in the client code, also the get() function will now throw an exception if an object's magic properties are accessed. The vulnerability does not exist in the default instance exposed by object path (e.g objectPath.del()) if using version >= 0.11.0.

How to fix Prototype Pollution?

Upgrade object-path to version 0.11.8 or higher.

>=0.11.0 <0.11.8
  • M
Prototype Pollution

object-path is a package to access deep properties using a path

Affected versions of this package are vulnerable to Prototype Pollution. A type confusion vulnerability can lead to a bypass of CVE-2020-15256 when the path components used in the path parameter are arrays. In particular, the condition currentPath === '__proto__' returns false if currentPath is ['__proto__']. This is because the === operator returns always false when the type of the operands is different.

PoC

const objectPath = require('object-path');

objectPath.withInheritedProps.set({}, [['__proto__'], 'polluted'], 'yes');
console.log(polluted); // yes

How to fix Prototype Pollution?

Upgrade object-path to version 0.11.6 or higher.

<0.11.6
  • H
Prototype Pollution

object-path is a package to access deep properties using a path

Affected versions of this package are vulnerable to Prototype Pollution. The setPath function can be used to add/modify properties of the Object prototype.

PoC

const setPath = require('object-path-set');
const obj = {};
console.log("Before : " + obj.polluted);
setPath({}, '__proto__.polluted', 'yes');
console.log("After : " + obj.polluted);

How to fix Prototype Pollution?

Upgrade object-path to version 0.11.5 or higher.

<0.11.5