Vulnerability record · CVE-2023-25157 · published 21 February 2023
CVE-2023-25157: GeoServer OGC filter SQL injection via CQL and PostGIS datastore
Osgeo · Geoserver
GeoServer supports the OGC Filter expression language and CQL through WFS, WMS and WCS, and mishandles certain filter constructs when a PostGIS datastore is used. This allows SQL injection into backend queries, which matters because GeoServer is commonly internet-facing and the flaw is trivially reachable without credentials.
Description
GeoServer is an open source software server written in Java that allows users to share and edit geospatial data. 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. Users are advised to upgrade to either version 2.21.4, or version 2.22.2 to resolve this issue. Users unable to upgrade should disable the PostGIS Datastore *encode functions* setting to mitigate ``strEndsWith``, ``strStartsWith`` and ``PropertyIsLike `` misuse and enable the PostGIS DataStore *preparedStatements* setting to mitigate the ``FeatureId`` misuse.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Automated analysis
critical priorityCVSS 9.8 with network reachability, no authentication and no user interaction, combined with a very high EPSS probability, makes this an urgent patch target.
What it is
GeoServer supports the OGC Filter expression language and CQL through WFS, WMS and WCS, and mishandles certain filter constructs when a PostGIS datastore is used. This allows SQL injection into backend queries, which matters because GeoServer is commonly internet-facing and the flaw is trivially reachable without credentials.
Impact
An unauthenticated attacker can inject arbitrary SQL into the PostGIS database, potentially reading, altering or deleting spatial and non-spatial data and, depending on database privileges, executing database functions. Full loss of confidentiality, integrity and availability of the backend data is possible.
Attack surface
Reached over the network through GeoServer's OGC endpoints (WFS, WMS, and WCS for ImageMosaic coverages) by sending crafted filter or CQL expressions. No authentication or user interaction is required per the CVSS vector (AV:N/AC:L/PR:N/UI:N).
Exploitation
Not listed in CISA KEV and no ransomware usage is documented, but EPSS is very high at 0.852 (99.7th percentile), indicating strong likelihood of exploitation. References are limited to the vendor advisory and patch commit, with no public exploit tag in the record.
What to do
- Upgrade GeoServer to 2.21.4 or 2.22.2 as advised by the vendor.
- If upgrade is not possible, disable the PostGIS Datastore 'encode functions' setting to mitigate strEndsWith, strStartsWith and PropertyIsLike misuse.
- Enable the PostGIS DataStore 'preparedStatements' setting to mitigate FeatureId misuse.
- Restrict network exposure of GeoServer OGC endpoints to trusted clients and place them behind authentication where feasible.
- Run the PostGIS datastore account with least privilege to limit the impact of successful injection.
Detection
- Inspect GeoServer and reverse-proxy access logs for OGC requests containing SQL metacharacters, UNION, stacked queries, or unusual CQL/filter syntax.
- Monitor PostGIS query logs for malformed or unexpected SQL originating from the GeoServer application account.
- Alert on anomalous request patterns to WFS, WMS and WCS endpoints, especially unauthenticated bursts from single sources.
- Check GeoServer configuration for the PostGIS encode functions and preparedStatements settings to confirm mitigations are applied.
This assessment is produced automatically and is not human-reviewed. Verify against the vendor advisory before acting on it.
Affected products
1 vulnerable configurations from NVD's CPE data, grouped by vendor and product.
References
Track CVE-2023-25157 inside VULONE
Watch it alongside the ransomware crews, C2 infrastructure and forum chatter that reference it, query it through the API and pull it into your SIEM over TAXII.
Related vulnerabilities
Same products first, then exploited flaws of the same weakness class.
Source: NIST National Vulnerability Database (record CVE-2023-25157), CISA KEV, FIRST EPSS (scores of 2026-09-24). This page is refreshed as NVD updates the record.