/

CVE-2026-76904

Severity:

CRITICAL RISK

(9.8)

SQL Injection (CWE-89) in GeoTools PostGIS DataStore

CVE-2026-76904

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database compromise and unauthorized data access

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A critical SQL injection vulnerability in GeoTools affects the PostGIS DataStore implementation when processing OGC Filters that use the jsonArrayContains function. If an attacker can influence the function's value input and the datastore uses a qualifying PostGIS String or JSON field, crafted data may alter generated SQL and access or modify database information.

Affected context

The issue occurs in GeoTools deployments using the PostGIS DataStore implementation with PostGIS 12 or later and a String or JSON field. It is associated with OGC Filter processing through the jsonArrayContains function, where a supplied value can be incorporated into generated SQL without adequate escaping.

Exploit preconditions

  • Attack surface: Applications or services that expose OGC Filter processing through GeoTools
  • Required access: Ability to submit or influence filter input, directly or through an integrating application
  • Trigger point: Evaluation of jsonArrayContains against a qualifying PostGIS field
  • Environmental requirement: PostGIS 12 or later with a String or JSON field
  • Why exploitation is possible: The function places the value into generated SQL without sufficient escaping or parameterization

Why this happens

The underlying flaw is the construction of SQL from externally influenced function values without reliably treating those values as data. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'). The insecure pattern is direct interpolation or concatenation of input into database statements instead of using parameterized queries, safe query-building abstractions, or equivalent context-aware encoding.

Potential impact

  • An attacker may read unauthorized database records
  • An attacker could alter or delete geospatial or application data
  • Database-level permissions may allow access to additional tables or schemas
  • Compromised data could affect downstream mapping, analytics, or business workflows
  • Application availability could be disrupted through destructive or resource-intensive queries

General mitigation guidance

Mitigation generally focuses on ensuring that all dynamic values are passed through parameterized database interfaces or trusted query-construction abstractions.

Common defensive patterns include:

  • Avoiding SQL string concatenation for filter-controlled values
  • Applying strict type, length, and schema validation before query generation
  • Reducing trust in client-supplied OGC Filter expressions
  • Configuring PostGIS connection pools with the minimum required database privileges
  • Separating read-only workloads from operations that can modify data
  • Restricting database roles, schemas, and network access to the smallest necessary scope

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying string concatenation or interpolation in SQL-building code
  • Code review checks for datastore functions that place filter values directly into generated statements
  • Tests using benign boundary characters and structured input to verify parameterization behavior
  • Database monitoring for unusual queries, unexpected schema access, or abnormal query volumes
  • API policy enforcement that limits accepted OGC Filter functions, field types, and input sizes
  • Neutral automated security review tools that flag injection-prone query construction patterns

Sources

SourceLink
github.comgithub.com/geotools/geotools/commit/d821c4d321dd91c22e31fcd5b1ce676645da5176
github.comgithub.com/geotools/geotools/pull/5829
github.comgithub.com/geotools/geotools/releases/tag/33.6
github.comgithub.com/geotools/geotools/releases/tag/34.5
github.comgithub.com/geotools/geotools/releases/tag/35.1
github.comgithub.com/geotools/geotools/security/advisories/GHSA-mqjf-5f49-2fjh
osgeo-org.atlassian.netosgeo-org.atlassian.net/browse/GEOT-7589
osgeo-org.atlassian.netosgeo-org.atlassian.net/browse/GEOT-7958
osgeo-org.atlassian.netosgeo-org.atlassian.net/browse/GEOT-7959

Frequently asked

questions

It may be remotely exploitable when an application exposes OGC Filter input to untrusted users and passes that input to the affected GeoTools PostGIS function. Exploitability depends on the integrating application's access controls and filter-processing behavior.

An attacker generally needs the ability to submit or influence a filter expression or its values. The resulting impact is constrained by the privileges assigned to the GeoTools database connection.

The safest pattern is to ensure that filter-derived values are handled through parameterized queries or a trusted query builder rather than inserted into SQL text, with validation applied before query generation.

Use least-privilege database roles, restrict and validate filter capabilities, review dynamic SQL construction, and monitor database activity for unexpected access or query patterns.

Find out what's already
exploitable in your codebase.