Summary
CVE-2026-54354 is a SQL injection vulnerability in MapServer, an open-source platform for building web-based GIS/mapping applications, affecting versions 8.4.0 through 8.6.3. The flaw resides in the PostGIS runtime filter translation logic, which fails to validate attacker-controlled input before embedding it in generated SQL predicates. It carries a CVSS v3.1 base score of 8.2 (High) and is remotely exploitable without authentication.
Technical details
- Root cause: The
msPostGISLayerTranslateFilter()function insrc/mappostgis.cpptreats a filter item as numeric whenever a layer is configured withCONNECTIONTYPE POSTGISand metadata such asgml_<item>_type=Integer. When a field is considered numeric, the generated right-hand value is left unquoted, andmsPostGISEscapeSQLParam()only escapes quotes/backslashes rather than validating that the value is a genuine numeric literal. - Trigger conditions: A layer must use PostGIS as its connection type and declare numeric-type metadata for the targeted item.
- Attack vector: Remote, unauthenticated. Exploitable via CGI query parameters (
mode=itemquery/mode=itemnquerywith theqstringparameter) or via OGC API Features item lookups using thefeatureIdparameter. Non-numeric payloads (e.g.,0 OR 1=1) are concatenated directly into the generated PostgreSQL/PostGIS predicate. - Impact: Attackers can bypass query predicates, enumerate unintended records, and perform boolean-based or time-based SQL injection against the backing PostGIS database, increasing database load. The vulnerability does not by itself grant database modification capability.
Affected software
- MapServer versions 8.4.0 up to (but not including) 8.6.4, when using
CONNECTIONTYPE POSTGISlayers with numeric field-type metadata configured.
Severity
- CVSS v3.1 Base Score: 8.2 (High)
- Vector:
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:L
Mitigation and recommended actions
- Immediate: Upgrade to MapServer 8.6.4 or later, which fixes the unvalidated numeric filter handling in the PostGIS translation code.
- If patching is not immediately possible:
- Restrict or disable public access to CGI
itemquery/itemnqueryendpoints and OGC API Features item-lookup endpoints on PostGIS-backed layers. - Review mapfiles for
CONNECTIONTYPE POSTGISlayers withgml_<item>_type=Integer(or similar numeric-type) metadata, and audit database logs for anomalous query patterns or errors indicative of injection attempts. - Apply least-privilege database credentials to the MapServer PostGIS connection to limit the blast radius of any successful injection.
- Restrict or disable public access to CGI

