CVE-2023-25158

ADVISORY - github

Summary

Impact

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:

  1. PropertyIsLike filter
    • Requires PostGIS DataStore with "encode functions" enabled
    • Or any JDBCDataStore (all relational databases) with String field (no mitigation)
  2. strEndsWith function
    • Requires PostGIS DataStore with "encode functions" enabled
  3. strStartsWith function
    • Requires PostGIS DataStore with "encode functions" enabled
  4. FeatureId filter
    • 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)
  5. jsonArrayContains function
    • Requires PostGIS and Oracle DataStore with String or JSON field
  6. DWithin filter
    • 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

EPSS Score: 0.01136 (0.774)

Common Weakness Enumeration (CWE)

ADVISORY - nist

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

ADVISORY - github

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

ADVISORY - gitlab

OWASP Top Ten 2017 Category A9 - Using Components with Known Vulnerabilities

Improper Neutralization

OWASP Top Ten 2013 Category A9 - Using Components with Known Vulnerabilities


NIST

CREATED

UPDATED

EXPLOITABILITY SCORE

3.9

EXPLOITS FOUND
-
COMMON WEAKNESS ENUMERATION (CWE)

CVSS SCORE

9.8critical

GitHub

CREATED

UPDATED

EXPLOITABILITY SCORE

3.9

EXPLOITS FOUND
-
COMMON WEAKNESS ENUMERATION (CWE)

CVSS SCORE

9.8critical

GitLab

CREATED

UPDATED

ADVISORY ID

CVE-2023-25158

EXPLOITABILITY SCORE

3.9

EXPLOITS FOUND
-
COMMON WEAKNESS ENUMERATION (CWE)

CVSS SCORE

9.8critical