CVE-2024-36404 GeoTools Remote Code Execution (RCE) vulnerability in evaluating XPath expressions

Critical 9.8 Published Updated

Attackers can execute arbitrary code via XPath injection in GeoTools if user input is evaluated, requiring library upgrades or removal of the gt-complex module.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2024-36404?

CVE-2024-36404 is a critical code injection vulnerability in geotools, published on 2 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

GeoTools is an open source Java library that provides tools for geospatial data. Prior to versions 31.2, 30.4, and 29.6, Remote Code Execution (RCE) is possible if an application uses certain GeoTools functionality to evaluate XPath expressions supplied by user input. Versions 31.2, 30.4, and 29.6 contain a fix for this issue. As a workaround, GeoTools can operate with reduced functionality by removing the `gt-complex` jar from one's application. As an example of the impact, application schema `datastore` would not function without the ability to use XPath expressions to query complex content. Alternatively, one may utilize a drop-in replacement GeoTools jar from SourceForge for versions 31.1, 30.3, 30.2, 29.2, 28.2, 27.5, 27.4, 26.7, 26.4, 25.2, and 24.0. These jars are for download only and are not available from maven central, intended to quickly provide a fix to affected applications.

Weakness: CWE-95

Which versions are affected by CVE-2024-36404?

24 open source packages ship an affected version, including org.geotools.xsd:gt-xsd-core, org.geotools:gt-app-schema and org.geotools:gt-complex.

PackageAffectedFixed in
org.geotools.xsd:gt-xsd-core MavenAll versions28.6
org.geotools.xsd:gt-xsd-core MavenAll versions28.6
org.geotools.xsd:gt-xsd-core MavenFrom 29.029.6
org.geotools.xsd:gt-xsd-core MavenFrom 29.029.6
org.geotools.xsd:gt-xsd-core MavenFrom 30.030.4
org.geotools.xsd:gt-xsd-core MavenFrom 30.030.4
18 more packages
org.geotools.xsd:gt-xsd-core MavenFrom 31.031.2
org.geotools.xsd:gt-xsd-core MavenFrom 31.031.2
org.geotools:gt-app-schema MavenAll versions28.6
org.geotools:gt-app-schema MavenAll versions28.6
org.geotools:gt-app-schema MavenFrom 29.029.6
org.geotools:gt-app-schema MavenFrom 29.029.6
org.geotools:gt-app-schema MavenFrom 30.030.4
org.geotools:gt-app-schema MavenFrom 30.030.4
org.geotools:gt-app-schema MavenFrom 31.031.2
org.geotools:gt-app-schema MavenFrom 31.031.2
org.geotools:gt-complex MavenAll versions28.6
org.geotools:gt-complex MavenAll versions28.6
org.geotools:gt-complex MavenFrom 29.029.6
org.geotools:gt-complex MavenFrom 29.029.6
org.geotools:gt-complex MavenFrom 30.030.4
org.geotools:gt-complex MavenFrom 30.030.4
org.geotools:gt-complex MavenFrom 31.031.2
org.geotools:gt-complex MavenFrom 31.031.2

How do I fix CVE-2024-36404?

Upgrade org.geotools.xsd:gt-xsd-core to a fixed version for your release line: 28.6, 29.6, 30.4 or 31.2.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2024-36404 being exploited?

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

Public exploit code: 1 Nuclei template.

Sources

Also known as GHSA-w3pj-wh35-fq8w.

Is CVE-2024-36404 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free