# CVE-2024-21534: JSONPath Plus Remote Code Execution (RCE) Vulnerability

> Attackers can execute arbitrary code on systems using the jsonpath-plus library due to unsafe VM usage and improper input sanitization.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H/E:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 11 Oct 2024
- **Updated:** 18 Nov 2024
- **Also known as:** CLSA-2026-1774657375, GHSA-pppg-cpfq-h7wr, MINI-m75p-pxrh-3xv8, ROOT-APP-NPM-CVE-2024-21534

## What is CVE-2024-21534?

CVE-2024-21534 is a critical code injection vulnerability in jsonpath-plus, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

All versions of the package jsonpath-plus 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](https://github.com/JSONPath-Plus/JSONPath/compare/v9.0.0...v10.1.0) but it could still be exploited using [different payloads](https://github.com/JSONPath-Plus/JSONPath/issues/226).

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2024-21534?

4 open source packages ship an affected version, including org.webjars.npm:jsonpath-plus and jsonpath-plus.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.webjars.npm:jsonpath-plus` | Maven | All versions to 6.0.1 | None |
| `org.webjars.npm:jsonpath-plus` | Maven | All versions to 6.0.1 | None |
| `jsonpath-plus` | npm | All versions | 10.2.0 |
| `jsonpath-plus` | npm | All versions | 10.2.0 |

## How do I fix CVE-2024-21534?

Upgrade to a fixed version.

## Is CVE-2024-21534 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21534 exists.

Public exploit code:

- POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE) due to improper input sanitization (github_poc): https://github.com/verylazytech/cve-2024-21534
- Proof-of-concept (PoC) exploit for JSONPath-plus vulnerability (github_poc): https://github.com/pabloopez/CVE-2024-21534
- https://github.com/BohemianHacks/CVE-2024-21534-poc (github_poc): https://github.com/BohemianHacks/CVE-2024-21534-poc

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-21534 and fix it if it is affected.

What it is: CVE-2024-21534 is a critical code injection vulnerability in jsonpath-plus, published on 11 Oct 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2024-21534 exists.

Affected packages and fixed versions:
- org.webjars.npm:jsonpath-plus (Maven): affected all versions up to 6.0.1; no fix listed
- org.webjars.npm:jsonpath-plus (Maven): affected all versions up to 6.0.1; no fix listed
- jsonpath-plus (npm): affected all versions; fixed in 10.2.0
- jsonpath-plus (npm): affected all versions; fixed in 10.2.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-21534/ (Markdown: https://insights.sbomify.com/CVE-2024-21534/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-21534
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-21534
- OSV: https://osv.dev/vulnerability/CVE-2024-21534

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-21534/
Summaries are generated and may contain mistakes; the official description above is the record.
