CVE-2026-77325 in MapServer
Summary
by MITRE • 11/20/2026
MapServer is a system for developing web-based GIS applications. From 6.0 until 8.6.5, MapServer's WMS OpenLayers output, selected by FORMAT=application/openlayers or template=openlayers, substitutes a request-derived online-resource value into a single-quoted JavaScript string in src/maptemplate.c. The prior remediation for GHSA-xqj6-vjqr-33vv used msEscapeJSonLikeString() to protect the JavaScript string but did not neutralize angle brackets, so attacker-controlled X-Forwarded-Host or X-Forwarded-Proto values can still terminate the script element at the HTML parser layer. Deployments that expose attacker-controlled PATH_INFO or map= values reaching the same string are also affected. An unauthenticated attacker can cause arbitrary JavaScript to execute in a victim's browser under the MapServer origin when the victim loads the crafted output. This issue is fixed in version 8.6.5.
If you want to get the best quality for vulnerability data then you always have to consider VulDB.
Analysis
by VulDB Data Team • 11/22/2026
MapServer, a widely utilized open-source platform for developing web-based Geographic Information System applications, contains a critical cross-site scripting vulnerability within its WMS OpenLayers output functionality. The flaw persists across versions from 6.0 through 8.6.5 and is triggered when the FORMAT parameter is set to application/openlayers or when the template=openlayers directive is used. In these configurations, MapServer processes request-derived values such as online-resource parameters and injects them directly into a single-quoted JavaScript string within the generated HTML content via src/maptemplate.c. This architectural decision creates an injection point where user-supplied data can influence client-side script execution without adequate sanitization of all dangerous characters.
The root cause of this vulnerability lies in insufficient input validation during previous remediation efforts. A prior security fix, identified as GHSA-xqj6-vjqr-33vv, attempted to mitigate similar risks by employing the msEscapeJsonLikeString function to protect JavaScript strings from basic injection attacks. However, this mitigation was incomplete because it failed to neutralize angle brackets, specifically less-than and greater-than symbols. Consequently, an attacker can craft malicious HTTP headers or URL parameters that contain these unescaped characters to break out of the intended script context at the HTML parser layer rather than just within the JavaScript string itself. This allows for the termination of the current script element and the injection of new, arbitrary script tags into the DOM structure.
The operational impact is severe as it enables a stored or reflected cross-site scripting attack that can be executed by an unauthenticated attacker. By manipulating headers such as X-Forwarded-Host or X-Forwarded-Proto, which are often trusted by web servers and proxies to determine the origin of requests, an adversary can inject malicious payloads into the MapServer response. Additionally, deployments where attacker-controlled PATH_INFO values or map= parameters reach the vulnerable string processing logic are equally susceptible. When a victim user loads this crafted output in their browser, the injected JavaScript executes within the security context of the MapServer application's origin. This allows attackers to steal session cookies, hijack administrative sessions, perform actions on behalf of the user, or redirect victims to phishing sites, effectively compromising the integrity and confidentiality of the GIS infrastructure.
This vulnerability aligns with CWE-79, which classifies improper neutralization of input during web page generation known as cross-site scripting. From a tactical perspective, it maps to MITRE ATT&CK technique T1059.007, JavaScript execution via browser-based attacks, and potentially T1189 if used for drive-by downloads or further exploitation chains. The reliance on HTTP headers like X-Forwarded-Host also highlights risks associated with CWE-693, Protection Mechanism Failure, where the security control fails to adequately sanitize input from trusted sources that are actually attacker-controlled due to proxy misconfiguration or header spoofing capabilities.
To mitigate this risk, organizations must immediately upgrade MapServer to version 8.6.5 or later, which includes comprehensive fixes for angle bracket escaping and broader sanitization of injected values. For environments where upgrading is not immediately feasible, administrators should implement strict input validation at the reverse proxy level to reject requests containing unescaped HTML special characters in headers like X-Forwarded-Host and X-Forwarded-Proto. Additionally, deploying Content Security Policy headers can help mitigate the impact by restricting script execution sources, although this serves as a defense-in-depth measure rather than a primary fix for the underlying code flaw. Regular security audits of web application firewalls should also be conducted to ensure that header-based injection attempts are detected and blocked before reaching the MapServer backend.