Vulnerabilities in pkg:maven/org.geotools/gt-jdbc
PACKAGECVE-2023-25158 is a CRITICAL (CVSS 9.8) sql injection vulnerability (CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')) affecting Gt jdbc libraries in the Maven ecosystem. The issue involves geotools ogc filter sql injection vulnerabilities. Remediation is available by upgrading affected packages to version 28.2, 27.4, 26.7, 25.7, 24.7.
pkg:maven/org.geotools/gt-jdbc
Vulnerability advisories affecting package pkg:maven/org.geotools/gt-jdbc. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-99c3-qc2q-p94m | CVE-2023-25158 | CRITICAL | GeoTools OGC Filter SQL Injection Vulnerabilities |
CVE-2023-25158 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-25158
To remediate this vulnerability, upgrade all affected Gt jdbc 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.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>28.2</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>27.4</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>26.7</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>25.7</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>24.7</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.geotools
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2023-25158, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.geotools
Analyze the terminal output to locate any version of Gt jdbc in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 28.2), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.geotools 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 Gt jdbc, 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-25158 Affected Gt jdbc Versions
5 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.geotools:gt-jdbc
|
Maven |
≥ 28.0
< 28.2
|
28.2
|
|
org.geotools:gt-jdbc
|
Maven |
≥ 27.0
< 27.4
|
27.4
|
|
org.geotools:gt-jdbc
|
Maven |
≥ 26.0
< 26.7
|
26.7
|
|
org.geotools:gt-jdbc
|
Maven |
≥ 25.0
< 25.7
|
25.7
|
|
org.geotools:gt-jdbc
|
Maven |
< 24.7
|
24.7
|
References
Frequently Asked Questions
What is CVE-2023-25158?
Which Gt jdbc versions are affected?
What version fixes CVE-2023-25158?
Is gt-jdbc affected?
What is the CVSS score of CVE-2023-25158?
What CWE is associated with CVE-2023-25158?
How can I check Maven dependencies for CVE-2023-25158?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-99c3-qc2q-p94m",
"modified" : "2023-02-22T19:16:06Z",
"published" : "2023-02-22T19:16:06Z",
"aliases" : [ "CVE-2023-25158" ],
"summary" : "GeoTools OGC Filter SQL Injection Vulnerabilities",
"details" : "### Impact\n\nGeoTools includes support for OGC Filter expression language parsing, encoding and execution against a range of datastore.\n\nSQL Injection Vulnerabilities have been found when executing OGC Filters with JDBCDataStore implementations:\n\n1. ``PropertyIsLike`` filter\n * Requires PostGIS DataStore with \"encode functions\" enabled\n * Or any JDBCDataStore (all relational databases) with String field (no mitigation)\n3. ``strEndsWith`` function\n * Requires PostGIS DataStore with \"encode functions\" enabled\n5. ``strStartsWith`` function\n * Requires PostGIS DataStore with \"encode functions\" enabled\n6. ``FeatureId`` filter\n * Requires JDBCDataStore (all relational databases) with prepared statements disabled and table with String primary key (Oracle not affected, SQL Server and MySQL have no settings to enabled prepared statements, PostGIS does)\n7. ``jsonArrayContains`` function\n * Requires PostGIS and Oracle DataStore with String or JSON field\n8. ``DWithin`` filter\n * Happens only in Oracle DataStore, no mitigation\n\n### Patches\n\n* GeoTools 28.2\n* GeoTools 27.4\n* GeoTools 26.7\n* GeoTools 25.7\n* GeoTools 24.7\n\n### Workarounds\n\nPartial mitigation:\n\n* In PostGIS DataStore disable \"encode functions\"\n* In any PostGIS enable \"prepared statements\" (only database with such settings)\n\n```java\n Map<String, Object> params = new HashMap<>();\n params.put(\"dbtype\", \"postgis\");\n params.put(\"host\", \"localhost\");\n params.put(\"port\", 5432);\n params.put(\"schema\", \"public\");\n params.put(\"database\", \"database\");\n params.put(\"user\", \"postgres\");\n params.put(\"passwd\", \"postgres\");\n params.put(\"preparedStatements\", true ); // mitigation\n params.put(\"encode functions\", false ); // mitigation\n\n DataStore dataStore = DataStoreFinder.getDataStore(params);\n```\n\n### References\n\n* [OGC Filter SQL Injection Vulnerabilities](https://github.com/geoserver/geoserver/security/advisories/GHSA-7g5f-wrx8-5ccf) (GeoServer)\n",
"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.geotools:gt-jdbc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "28.0"
}, {
"fixed" : "28.2"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.geotools:gt-jdbc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "27.0"
}, {
"fixed" : "27.4"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.geotools:gt-jdbc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "26.0"
}, {
"fixed" : "26.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.geotools:gt-jdbc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "25.0"
}, {
"fixed" : "25.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.geotools:gt-jdbc"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "24.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/geotools/geotools/security/advisories/GHSA-99c3-qc2q-p94m"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-25158"
}, {
"type" : "WEB",
"url" : "https://github.com/geotools/geotools/commit/64fb4c47f43ca818c2fe96a94651bff1b3b3ed2b"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/geotools/geotools"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-89" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2023-02-22T19:16:06Z",
"nvd_published_at" : "2023-02-21T21:15:00Z"
}
}