# CVE-2023-35042: GeoServer RCE due to improper control of generation of code in jai-ext`Jiffle` map algebra language

> Remote attackers can execute arbitrary code via WPS requests in certain GeoServer configurations, posing a critical risk to geospatial data servers.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 12 Jun 2023
- **Updated:** 27 Nov 2024
- **Also known as:** GHSA-59x6-g4jr-4hxc

## What is CVE-2023-35042?

CVE-2023-35042 is a critical code injection vulnerability in n/a, published on 12 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

GeoServer 2, in some configurations, allows remote attackers to execute arbitrary code via java.lang.Runtime.getRuntime().exec in wps:LiteralData within a wps:Execute request, as exploited in the wild in June 2023. NOTE: the vendor states that they are unable to reproduce this in any version.

## Which versions are affected by CVE-2023-35042?

18 open source packages ship an affected version, including org.geoserver:gs-wfs, org.geoserver:gs-wms and org.geoserver:gs-wps. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.geoserver:gs-wfs` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wfs` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wfs` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wfs` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wfs` | Maven | From 2.20.0 | 2.20.4 |
| `org.geoserver:gs-wfs` | Maven | From 2.20.0 | 2.20.4 |
| `org.geoserver:gs-wms` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wms` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wms` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wms` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wms` | Maven | From 2.20.0 | 2.20.4 |
| `org.geoserver:gs-wms` | Maven | From 2.20.0 | 2.20.4 |
| `org.geoserver:gs-wps` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wps` | Maven | All versions | 2.18.6 |
| `org.geoserver:gs-wps` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wps` | Maven | From 2.19.0 | 2.19.6 |
| `org.geoserver:gs-wps` | Maven | From 2.20.0 | 2.20.4 |
| `org.geoserver:gs-wps` | Maven | From 2.20.0 | 2.20.4 |

Products: Geoserver Geoserver.

## How do I fix CVE-2023-35042?

Upgrade org.geoserver:gs-wfs to a fixed version for your release line: 2.18.6, 2.19.6 or 2.20.4.

## Is CVE-2023-35042 being exploited?

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

## Other vulnerabilities in n/a

- [CVE-2024-36401](https://insights.sbomify.com/CVE-2024-36401/): OSGeo GeoServer GeoTools Eval Injection (critical 9.8, exploited in the wild)
- [CVE-2025-58360](https://insights.sbomify.com/CVE-2025-58360/): OSGeo GeoServer Improper Restriction of XML External Entity Reference (high 8.2, exploited in the wild)
- [CVE-2024-24749](https://insights.sbomify.com/CVE-2024-24749/): Classpath resource disclosure in GWC Web Resource API on Windows / Tomcat (high 7.5)
- [CVE-2023-41877](https://insights.sbomify.com/CVE-2023-41877/): GeoServer log file path traversal vulnerability (high 7.2)
- [CVE-2023-51444](https://insights.sbomify.com/CVE-2023-51444/): GeoServer arbitrary file upload vulnerability in REST Coverage Store API (high 7.2)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-35042 and fix it if it is affected.

What it is: CVE-2023-35042 is a critical code injection vulnerability in n/a, published on 12 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2023-35042 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.geoserver:gs-wfs (Maven): affected all versions; fixed in 2.18.6
- org.geoserver:gs-wfs (Maven): affected all versions; fixed in 2.18.6
- org.geoserver:gs-wfs (Maven): affected from 2.19.0; fixed in 2.19.6
- org.geoserver:gs-wfs (Maven): affected from 2.19.0; fixed in 2.19.6
- org.geoserver:gs-wfs (Maven): affected from 2.20.0; fixed in 2.20.4
- org.geoserver:gs-wfs (Maven): affected from 2.20.0; fixed in 2.20.4
- org.geoserver:gs-wms (Maven): affected all versions; fixed in 2.18.6
- org.geoserver:gs-wms (Maven): affected all versions; fixed in 2.18.6
- org.geoserver:gs-wms (Maven): affected from 2.19.0; fixed in 2.19.6
- org.geoserver:gs-wms (Maven): affected from 2.19.0; fixed in 2.19.6
- org.geoserver:gs-wms (Maven): affected from 2.20.0; fixed in 2.20.4
- org.geoserver:gs-wms (Maven): affected from 2.20.0; fixed in 2.20.4

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

## Sources

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

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