# CVE-2024-39565: Junos OS: J-Web: An unauthenticated, network-based attacker can perform XPATH injection attack against a device.

> Unauthenticated attackers can execute remote commands via XPath injection in J-Web, potentially gaining full device control.

- **Severity:** High 7.7 (`CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/AU:Y/V:C/RE:M/U:Amber`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 10 Jul 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-9xg8-vx2w-7c89

## What is CVE-2024-39565?

CVE-2024-39565 is a high-severity code injection vulnerability in Juniper Junos, published on 10 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

An Improper Neutralization of Data within XPath Expressions ('XPath Injection') vulnerability in J-Web shipped with Juniper Networks Junos OS allows an unauthenticated, network-based attacker to execute remote commands on the target device. 

While an administrator is logged into a J-Web session or has previously logged in and subsequently logged out of their J-Web session, the attacker can arbitrarily execute commands on the target device with the other user's credentials. In the worst case, the attacker will have full control over the device.
This issue affects Junos OS: 

  *  All versions before 21.2R3-S8, 
  *  from 21.4 before 21.4R3-S7,
  *  from 22.2 before 22.2R3-S4,
  *  from 22.3 before 22.3R3-S3,
  *  from 22.4 before 22.4R3-S2,
  *  from 23.2 before 23.2R2,
  *  from 23.4 before 23.4R1-S1, 23.4R2.

Weakness: CWE-643 (Improper Neutralization of Data within XPath Expressions)

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

It affects 2 products.


Products: Juniper J-Web, Juniper Junos.

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

No fix has been published for CVE-2024-39565 yet. Limit exposure of the affected software until one is available.

## Is CVE-2024-39565 being exploited?

There is no known exploitation of CVE-2024-39565 in the wild and no public exploit code.

## Fix prompt for AI coding agents

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

What it is: CVE-2024-39565 is a high-severity code injection vulnerability in Juniper Junos, published on 10 Jul 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-39565 in the wild and no public exploit code.

Affected product: Juniper Junos. No package-level version data is available, so check the vendor advisory linked from the reference page.

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-39565/ (Markdown: https://insights.sbomify.com/CVE-2024-39565/index.md)
```

## Sources

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

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