Skip to content
SQL injection Write-up Intermediate

Cve 2023 25157 Geoservers Sql Injection Vulnerabilities

GeoServer versions before 2.21.4 and 2.22.2 did not properly sanitise user input in the CQL_FILTER parameter of WFS and WMS requests, leading to SQL injection. An attacker could execute arbitrary SQL commands, potentially accessing or modifying data, causing denial of service, or, with admin privileges, taking full control of the server.

Sandeep Vishwakarma Follow

Published on infosecwriteups.com

GeoServer, a Java-based open-source software server facilitating the sharing and manipulation of geospatial data, encountered a security challenge on June 6, 2023. Specifically, two SQL injection vulnerabilities, identified as CVE-2023–25157 and CVE-2023–25158, were brought to light by a security researcher.

Sandeep Vishwakarma, on infosecwriteups.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the CQL_FILTER parameter was passed into SQL queries without sufficient sanitisation, allowing injection.

Impact

The severity depends on the attacker's privileges: an administrator could take complete control of the server, while lesser-privileged users could still compromise sensitive data or disrupt availability.

What the attacker needed

Access to a vulnerable GeoServer instance; Ability to send HTTP requests to WFS/WMS endpoints; For full impact, admin privileges on GeoServer

The fix

The vulnerabilities were fixed in GeoServer versions 2.21.4 and 2.22.2; as a temporary measure, disable the PostGIS Datastore encode functions setting and enable the preparedStatements setting.

How it was found

  1. Send a GetCapabilities request to the target GeoServer to retrieve available feature names.
  2. For each feature name, send requests with crafted CQL_FILTER parameters using filter functions such as strStartsWith or PropertyIsLike.
  3. Check the response status code; if 200, parse the JSON response to extract property names.
  4. Send further requests with the CQL_FILTER payload for each property and observe results to confirm SQL injection.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

GeoServer is a program that lets organisations share maps and geographic data over the web. It accepted special filter instructions from users without checking them properly, so someone could sneak in database commands. That could let them read or change data, or even take over the server if they had high-level access.

What is SQL injection?

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.

More by Sandeep Vishwakarma

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.