GHSA-99C3-QC2Q-P94M
Vulnerability from github – Published: 2023-02-22 19:16 – Updated: 2023-02-22 19:16Impact
GeoTools includes support for OGC Filter expression language parsing, encoding and execution against a range of datastore.
SQL Injection Vulnerabilities have been found when executing OGC Filters with JDBCDataStore implementations:
PropertyIsLikefilter- Requires PostGIS DataStore with "encode functions" enabled
- Or any JDBCDataStore (all relational databases) with String field (no mitigation)
strEndsWithfunction- Requires PostGIS DataStore with "encode functions" enabled
strStartsWithfunction- Requires PostGIS DataStore with "encode functions" enabled
FeatureIdfilter- 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)
jsonArrayContainsfunction- Requires PostGIS and Oracle DataStore with String or JSON field
DWithinfilter- Happens only in Oracle DataStore, no mitigation
Patches
- GeoTools 28.2
- GeoTools 27.4
- GeoTools 26.7
- GeoTools 25.7
- GeoTools 24.7
Workarounds
Partial mitigation:
- In PostGIS DataStore disable "encode functions"
- In any PostGIS enable "prepared statements" (only database with such settings)
Map<String, Object> params = new HashMap<>();
params.put("dbtype", "postgis");
params.put("host", "localhost");
params.put("port", 5432);
params.put("schema", "public");
params.put("database", "database");
params.put("user", "postgres");
params.put("passwd", "postgres");
params.put("preparedStatements", true ); // mitigation
params.put("encode functions", false ); // mitigation
DataStore dataStore = DataStoreFinder.getDataStore(params);
References
- OGC Filter SQL Injection Vulnerabilities (GeoServer)
{
"affected": [
{
"package": {
"ecosystem": "Maven",
"name": "org.geotools:gt-jdbc"
},
"ranges": [
{
"events": [
{
"introduced": "28.0"
},
{
"fixed": "28.2"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geotools:gt-jdbc"
},
"ranges": [
{
"events": [
{
"introduced": "27.0"
},
{
"fixed": "27.4"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geotools:gt-jdbc"
},
"ranges": [
{
"events": [
{
"introduced": "26.0"
},
{
"fixed": "26.7"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geotools:gt-jdbc"
},
"ranges": [
{
"events": [
{
"introduced": "25.0"
},
{
"fixed": "25.7"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "Maven",
"name": "org.geotools:gt-jdbc"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "24.7"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2023-25158"
],
"database_specific": {
"cwe_ids": [
"CWE-89"
],
"github_reviewed": true,
"github_reviewed_at": "2023-02-22T19:16:06Z",
"nvd_published_at": "2023-02-21T21:15:00Z",
"severity": "CRITICAL"
},
"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\u003cString, Object\u003e params = new HashMap\u003c\u003e();\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",
"id": "GHSA-99c3-qc2q-p94m",
"modified": "2023-02-22T19:16:06Z",
"published": "2023-02-22T19:16:06Z",
"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"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H",
"type": "CVSS_V3"
}
],
"summary": "GeoTools OGC Filter SQL Injection Vulnerabilities"
}
Drag nodes to arrange them. Double-click a related vulnerability to open it, or a source to visit its link. The Physics button on the left tunes the layout and the simulation; the legend at the bottom left hides or shows nodes by kind and by sighting type.
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
Vulnerability timeline
Sightings and recorded dates, grouped by day · UTC
Loading timeline…
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.