CVE-2023-25157 & CVE-2023-25158: SQLi Bugs in GeoTools & GeoServer

CVE-2023-25157

A now-patched security flaw in the GeoTools JavaScript module and GeoServer could be abused by a remote adversary to view, add, modify, or delete information in the back-end database.

GeoServer includes support for the OGC Filter expression language and the OGC Common Query Language (CQL) as part of the Web Feature Service (WFS) and Web Map Service (WMS) protocols. CQL is also supported through the Web Coverage Service (WCS) protocol for ImageMosaic coverages,” the developer said in an advisory published on February 22, 2023.

SQL Injection Vulnerabilities have been found with:

  • PropertyIsLike filter, when used with a String field and any database DataStore, or with a PostGIS DataStore with encode functions enabled
  • strEndsWith function, when used with a PostGIS DataStore with encode functions enabled
  • strStartsWith function, when used with a PostGIS DataStore with encode functions enabled
  • FeatureId filter, when used with any database table having a String primary key column and when prepared statements are disabled
  • jsonArrayContains function, when used with a String or JSON field and with a PostGIS or Oracle DataStore (GeoServer 2.22.0+ only)
  • DWithin filter, when used with an Oracle DataStore

The issues tracked as CVE-2023-25157 affecting GeoServer and CVE-2023-25158 affecting GeoTools carry a critical severity rating of 9.8 on the CVSS vulnerability scoring system that was calculated by Github. They have been addressed in GeoServer versions 2.21.4, 2.22.2, 2.20.7, 2.19.7, and GeoTools versions 28.2, 27.4, 26.7, 25.7, and 24.7 released this week.

CVE-2023-25157

GeoTools is an open-source (LGPL) Java code library that provides standards-compliant methods for the manipulation of geospatial data, for example, to implement Geographic Information Systems. The GeoTools library data structures are based on Open Geospatial Consortium (OGC) specifications. GeoServer is an open-source software server written in Java that allows users to share and edit geospatial data.

This means that successful exploitation of CVE-2023-25157 and CVE-2023-25158 could permit an attacker to spoof identity, tamper with existing data, cause repudiation issues such as voiding transactions or changing balances, allow the complete disclosure of all data on the system, destroy the data or make it otherwise unavailable, and become administrators of the database server.

Users are recommended to update to the latest version as soon as possible to mitigate possible threats.