Vulnerabilities in pkg:maven/org.geoserver.community/gs-jdbcconfig

PACKAGE
Advisory Identifier: GHSA-7g5f-wrx8-5ccf
Advisory Summary

CVE-2023-25157 is a CRITICAL (CVSS 9.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Gs jdbcconfig libraries in the Maven ecosystem. The issue involves geoserver ogc filter sql injection vulnerabilities. Remediation is available by upgrading affected packages to version 2.21.4, 2.22.2.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.geoserver.community/gs-jdbcconfig

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.geoserver.community/gs-jdbcconfig. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-7g5f-wrx8-5ccf CVE-2023-25157 CRITICAL GeoServer OGC Filter SQL Injection Vulnerabilities

CVE-2023-25157 at a Glance

CVE Identifier CVE-2023-25157
GHSA Identifier GHSA-7g5f-wrx8-5ccf
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')
Affected Product Gs jdbcconfig
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2023-25157

To remediate this vulnerability, upgrade all affected Gs jdbcconfig dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

org.geoserver.community:gs-jdbcconfig fixed: 2.21.4
<dependency>
    <groupId>org.geoserver.community</groupId>
    <artifactId>gs-jdbcconfig</artifactId>
    <version>2.21.4</version>
</dependency>
org.geoserver.community:gs-jdbcconfig fixed: 2.22.2
<dependency>
    <groupId>org.geoserver.community</groupId>
    <artifactId>gs-jdbcconfig</artifactId>
    <version>2.22.2</version>
</dependency>
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

mvn dependency:tree -Dincludes=org.geoserver.community

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2023-25157, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.geoserver.community

Analyze the terminal output to locate any version of Gs jdbcconfig in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.21.4), your application is affected.

Note: The mvn dependency:tree -Dincludes=org.geoserver.community command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where the product constructs all or part of an sql command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended sql command when it is sent to a downstream component. without sufficient removal or quoting of sql syntax in user-controllable inputs, the generated sql query can cause those inputs to be interpreted as sql instead of ordinary user data. In Gs jdbcconfig, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact 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. 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 ### Patches * GeoSever 2.21.4 * GeoServer 2.22.2 * GeoServer 2.20.7 * GeoServer 2.19.7 * GeoServer 2.18.7 ### Workarounds 1. Disabling the PostGIS Datastore *encode functions* setting to mitigate ``strEndsWith``, ``strStartsWith`` vulnerabilities (Like filters have no mitigation, if there is a string field in the feature type published). 2. Enabling the PostGIS DataStore *preparedStatements* setting to mitigate the ``FeatureId`` vulnerability. ### References * [OGC Filter SQL Injection Vulnerabilities](https://github.com/geotools/geotools/security/advisories/GHSA-99c3-qc2q-p94m) (GeoTools) * [OGC Filter Injection Vulnerability Statement](https://geoserver.org/vulnerability/2023/02/20/ogc-filter-injection.html) (GeoServer Blog)

CVE-2023-25157 Affected Gs jdbcconfig Versions

2 component(s)
Fixed Versions:
2.21.42.22.2
Product / Package Ecosystem Affected Versions Fixed Version
org.geoserver.community:gs-jdbcconfig
Maven
< 2.21.4
2.21.4
org.geoserver.community:gs-jdbcconfig
Maven
≥ 2.22.0
< 2.22.2
2.22.2

References

Frequently Asked Questions

What is CVE-2023-25157?
CVE-2023-25157 is a security vulnerability in Gs jdbcconfig involving GeoServer OGC Filter SQL Injection Vulnerabilities under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Which Gs jdbcconfig versions are affected?
Affected versions include releases prior to 2.21.4, 2.22.2 across affected packages: org.geoserver.community:gs-jdbcconfig.
What version fixes CVE-2023-25157?
Upgrading to 2.21.4, 2.22.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gs-jdbcconfig affected?
Yes, org.geoserver.community:gs-jdbcconfig is affected in releases prior to 2.21.4, 2.22.2. Upgrade your dependency to 2.21.4, 2.22.2 or later.
What is the CVSS score of CVE-2023-25157?
CVE-2023-25157 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2023-25157?
CVE-2023-25157 is classified under CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') (The product constructs all or part of an SQL command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended SQL command when it is sent to a downstream component. Without sufficient removal or quoting of SQL syntax in user-controllable inputs, the generated SQL query can cause those inputs to be interpreted as SQL instead of ordinary user data.).
How can I check Maven dependencies for CVE-2023-25157?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.geoserver.community'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-7g5f-wrx8-5ccf",
  "modified" : "2023-02-22T19:15:56Z",
  "published" : "2023-02-22T19:15:56Z",
  "aliases" : [ "CVE-2023-25157" ],
  "summary" : "GeoServer OGC Filter SQL Injection Vulnerabilities",
  "details" : "### Impact\n\nGeoServer 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.\n\nSQL Injection Vulnerabilities have been found with:\n\n* ``PropertyIsLike`` filter, when used with a String field and any database DataStore, or with a PostGIS DataStore with encode functions enabled\n* ``strEndsWith`` function, when used with a PostGIS DataStore with encode functions enabled\n* ``strStartsWith`` function, when used with a PostGIS DataStore with encode functions enabled\n* ``FeatureId`` filter, when used with any database table having a String primary key column and when prepared statements are disabled\n* ``jsonArrayContains`` function, when used with a String or JSON field and with a PostGIS or Oracle DataStore (GeoServer 2.22.0+ only)\n* ``DWithin`` filter, when used with an Oracle DataStore\n\n### Patches\n\n* GeoSever 2.21.4\n* GeoServer 2.22.2\n* GeoServer 2.20.7\n* GeoServer 2.19.7\n* GeoServer 2.18.7\n\n### Workarounds\n\n1. Disabling the PostGIS Datastore *encode functions* setting to mitigate ``strEndsWith``, ``strStartsWith`` vulnerabilities (Like filters have no mitigation, if there is a string field in the feature type published).\n2. Enabling the PostGIS DataStore *preparedStatements* setting to mitigate the ``FeatureId`` vulnerability.\n\n### References\n\n* [OGC Filter SQL Injection Vulnerabilities](https://github.com/geotools/geotools/security/advisories/GHSA-99c3-qc2q-p94m) (GeoTools)\n* [OGC Filter Injection Vulnerability Statement](https://geoserver.org/vulnerability/2023/02/20/ogc-filter-injection.html) (GeoServer Blog)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver.community:gs-jdbcconfig"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.21.4"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.geoserver.community:gs-jdbcconfig"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.22.0"
      }, {
        "fixed" : "2.22.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/security/advisories/GHSA-7g5f-wrx8-5ccf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-25157"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/geoserver/geoserver/commit/145a8af798590288d270b240235e89c8f0b62e1d"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/geoserver/geoserver"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-89" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-22T19:15:56Z",
    "nvd_published_at" : "2023-02-21T22:15:00Z"
  }
}