CVE-2026-77326: MapServer: Heap buffer overflow in WMS GetLegendGraphic via repeated LAYER parameters
MapServer is a system for developing web-based GIS applications. From 8.2.0 until 8.6.5, an unauthenticated attacker can send a WMS GetLegendGraphic request with a nonempty BBOX and repeated LAYER parameters to trigger a heap buffer overflow in msWMSDispatch() in src/mapwms.cpp. The handler appends synthesized entries to cgiRequestObj.ParamNames and cgiRequestObj.ParamValues at NumParams without retaining the arrays' capacity or reallocating them, while incrementing NumParams inside the loop. Once the parser's hidden capacity is exhausted, the writes pass the heap allocation boundary. A single request can corrupt heap memory and crash the process; code execution may be possible but was not demonstrated. This issue is fixed in version 8.6.5.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
MapServerto a version that resolves this vulnerability.Fixed in 8.6.5
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
MapServer versions from 8.2.0 through 8.6.5 are affected when they process WMS GetLegendGraphic requests. An unauthenticated network attacker can reach the vulnerable handler if the WMS service is exposed to them.
What does an attacker need to send to trigger the overflow?
The attacker needs to submit a WMS GetLegendGraphic request containing a nonempty BBOX and repeated LAYER parameters. No authentication, user interaction, or prior privileges are required.
What is the likely impact of successful exploitation?
A single malicious request can corrupt heap memory and crash the MapServer process, creating a denial-of-service condition. Code execution may be possible, but it was not demonstrated.
What should teams do if they cannot immediately update?
Restrict access to the WMS GetLegendGraphic endpoint to trusted clients where possible, and filter or reject requests with repeated LAYER parameters or a nonempty BBOX for this operation. Updating to version 8.6.5 is the stated fix.