CVE-2023-25158: GeoTools OGC Filter SQL Injection Vulnerabilities

org.geotools:gt-jdbc Updated 02 Oct 2025

Summary

22/02/2023
Yes i
Critical
9.8

CVE-2023-25158: GeoTools OGC Filter SQL Injection Vulnerabilities. Affects org.geotools:gt-jdbc across 5 version ranges.

< 24.7 >= 25.0, < 25.7 >= 26.0, < 26.7 >= 27.0, < 27.4 >= 28.0, < 28.2

Fixed in 5 releases; the minimum fixed version depends on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

GeoTools is an open-source Java library that provides tools for geospatial data processing. It includes support for OGC Filter expression language parsing, encoding, and execution against various data stores. This vulnerability affects the JDBCDataStore implementations in GeoTools.

Vulnerability Detail

The vulnerability involves SQL injection when executing OGC Filters with JDBCDataStore implementations. Several specific filters and functions are affected, including PropertyIsLike, strEndsWith, strStartsWith, FeatureId, jsonArrayContains, and DWithin. The impact varies depending on the data store used and the specific filter or function. For example, in some cases, an attacker could execute arbitrary SQL queries, potentially leading to unauthorized data access or modification.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 24.7 24.7
  • >= 25.0, < 25.7 25.7
  • >= 26.0, < 26.7 26.7
  • >= 27.0, < 27.4 27.4
  • >= 28.0, < 28.2 28.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

A partial mitigation can be achieved by disabling "encode functions" in the PostGIS DataStore or enabling "prepared statements" in any PostGIS database. Here is an example of enabling "prepared statements" in a PostGIS DataStore:

Map<String, Object> params = new HashMap<>();
params.put("dbtype", "postgis");
params.put("host", "localhost");
params.put("port", 5432);
params.put("schema", "public");
params.put("database", "database");
params.put("user", "postgres");
params.put("passwd", "postgres");
params.put("preparedStatements", true ); // mitigation
params.put("encode functions", false ); // mitigation

DataStore dataStore = DataStoreFinder.getDataStore(params);

Conclusion

The GeoTools OGC Filter SQL Injection Vulnerabilities pose a significant security risk, potentially allowing attackers to execute arbitrary SQL queries. It is crucial to update GeoTools to one of the patched versions and apply the recommended fixes. For further support on vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for org.geotools:gt-jdbc →

Share this vulnerability

FAQ

GeoTools is an open-source Java library for geospatial data processing.

OGC Filter expression language is a standard language for querying geospatial data.

The vulnerability affects GeoTools versions 24.7 to 28.1.

The vulnerability could allow an attacker to execute arbitrary SQL queries, potentially leading to unauthorized data access or modification.

A partial mitigation can be achieved by disabling "encode functions" in the PostGIS DataStore or enabling "prepared statements" in any PostGIS database.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 24.7 24.7
  • >= 25.0, < 25.7 25.7
  • >= 26.0, < 26.7 26.7
  • >= 27.0, < 27.4 27.4
  • >= 28.0, < 28.2 28.2

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback