CVE-2023-25157: Gs jdbcconfig SQL Injection Vulnerability
CRITICALCVE-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.
CVE-2023-25157 at a Glance
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).
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.
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-jdbcconfig</artifactId>
<version>2.21.4</version>
</dependency>
<dependency>
<groupId>org.geoserver.community</groupId>
<artifactId>gs-jdbcconfig</artifactId>
<version>2.22.2</version>
</dependency>
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
CVE-2023-25157 Affected Gs jdbcconfig Versions
2 component(s)| 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?
Which Gs jdbcconfig versions are affected?
What version fixes CVE-2023-25157?
Is gs-jdbcconfig affected?
What is the CVSS score of CVE-2023-25157?
What CWE is associated with CVE-2023-25157?
How can I check Maven dependencies for CVE-2023-25157?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}