CVE-2026-77327 in MapServer
Summary
by MITRE • 11/20/2026
MapServer is a system for developing web-based GIS applications. Prior to 8.6.5, MapServer's MySQL JOIN implementation in src/mapjoin.c copies the source layer attribute selected by JOIN ... FROM into joininfo->target and inserts it into the query built by msMySQLJoinNext() without parameterization or SQL escaping. When MySQL JOIN support is enabled, an attacker who can control that source feature attribute, including through imported shapefile or DBF data or another untrusted spatial source, can inject SQL operators or expressions that change the intended JOIN predicate. This can bypass the intended key comparison and expose unrelated records from the MySQL or MariaDB JOIN table through output templates, query responses, or downstream application logic. This issue is fixed in version 8.6.5.
If you want to get best quality of vulnerability data, you may have to visit VulDB.
Analysis
by VulDB Data Team • 11/20/2026
MapServer serves as a foundational system for developing web-based Geographic Information System applications, facilitating the integration of spatial data with relational databases to deliver dynamic mapping services. Within this architecture, the MySQL JOIN implementation located in src/mapjoin.c plays a critical role in linking geographic features stored in shapefiles or other vector formats with attribute data residing in external SQL databases such as MySQL or MariaDB. This functionality allows applications to enrich map layers with detailed tabular information by executing complex queries that combine spatial and non-spatial datasets based on defined keys. The integrity of these join operations relies heavily on the secure construction of SQL statements, ensuring that user-supplied or externally sourced data does not alter the logical structure of the query intended by the application developer.
A critical vulnerability exists in versions prior to 8.6.5 where the implementation fails to properly sanitize input when constructing JOIN predicates. Specifically, the code copies source layer attributes selected via a JOIN FROM clause directly into joininfo->target and inserts them into the SQL query generated by msMySQLJoinNext without applying parameterization or escaping mechanisms. This architectural flaw means that any attribute value derived from untrusted sources, such as imported shapefiles, DBF data files, or other spatial inputs controlled by an attacker, is treated as executable code rather than literal string data. Consequently, if an adversary can manipulate the content of these source features, they can inject arbitrary SQL operators or expressions into the join condition.
The operational impact of this flaw is severe, constituting a classic case of SQL injection that compromises both confidentiality and integrity within the GIS application environment. By injecting malicious SQL syntax, an attacker can bypass the intended key comparison logic used to match records between the spatial layer and the database table. This manipulation allows for the extraction of unrelated or sensitive records from the MySQL or MariaDB JOIN table that were not originally accessible through normal query parameters. The exposed data may be rendered in output templates, returned via API responses, or processed by downstream application logic, potentially leading to unauthorized access to proprietary geographic datasets, customer information, or other confidential attributes stored within the relational database backend.
This vulnerability aligns with CWE-89 Improper Neutralization of Special Elements used in an SQL Command and is categorized under ATT&CK technique T1059 Command and Scripting Interpreter through its exploitation via injected code elements that alter program flow. The root cause stems from a failure to implement parameterized queries or robust input validation, which are standard security practices for preventing injection attacks in database-driven applications. To mitigate this risk, organizations must upgrade MapServer to version 8.6.5 or later where the issue has been resolved through proper sanitization and parameterization of join attributes. Additionally, developers should enforce strict data validation on all spatial inputs and avoid embedding user-controlled values directly into SQL strings without appropriate escaping functions provided by the database driver library.