A critical vulnerability in MapLibre GL JS could allow attackers to execute zero-click cross-site scripting attacks through malicious map attribution content.
Tracked as CVE-2026-85061 and GitHub Security Advisory GHSA-jrc7-96c5-q579, the flaw affects maplibre-gl versions 6.4.0 and earlier. MapLibre GL JS version 6.4.1 addresses the issue.
The vulnerability resides in DOM.sanitize() within src/util/dom.ts, a function intended to remove potentially dangerous HTML attributes before content is rendered.
Critical MapLibre GL JS Flaw Allows Zero-Click XSS Attacks
However, the sanitizer iterated through an element’s attributes collection while removing attributes from that same collection. Because elem.attributes is a live NamedNodeMap, deleting one attribute changes the positions of the remaining entries during iteration.
This behavior introduces an attribute-skipping condition. When the sanitizer removes a dangerous attribute, the immediately following attribute shifts down by one index.
The loop then increments its counter, bypassing the shifted attribute without evaluating or removing it. An attacker can abuse this logic by submitting HTML containing consecutive unsafe attributes, allowing one malicious event handler to remain intact after sanitization.
A proof-of-concept payload could use a <details> element with attributes positioned consecutively, such as open, onload, and ontoggle.
The sanitizer may strip the first unsafe attribute but skip the next one. If the surviving event-handler attribute is inserted into the page through MapLibre’s attribution-control rendering flow, JavaScript can execute automatically without a victim clicking, hovering, or otherwise interacting with the page.
The attack’s zero-click nature significantly raises risk for affected applications. The advisory assigns the flaw a Critical severity rating with a CVSS v3.1 vector of AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N.
This means exploitation can occur remotely, requires low complexity, needs no attacker privileges, and does not depend on user interaction. Successful exploitation can compromise confidentiality and integrity within the impacted application’s browser context.
HarelM stated that applications are particularly exposed when they render map styles, attribution strings, or source metadata obtained from third parties.
Risk scenarios include mapping portals that load externally hosted styles, platforms that let users configure custom map attributions, and applications that consume map metadata from untrusted providers.
In these environments, attackers may inject crafted attribution values that reach the vulnerable sanitization routine. The underlying weakness is classified as CWE-79, Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
While the flaw is located in a sanitization utility, the real impact depends on whether attacker-controlled content can reach the attribute control and ultimately be inserted through innerHTML.
MapLibre fixed the issue by creating a static snapshot of attributes before processing them. Instead of iterating directly over the live NamedNodeMap, the patched code uses Array.from(elem.attributes).
This prevents index positions from changing during removal operations and ensures every attribute is checked. Organizations using MapLibre GL JS should upgrade immediately to version 6.4.1 or later.
Until upgrades are complete, developers should strictly sanitize and validate source attribution fields before passing them to MapLibre, especially when styles or metadata originate from untrusted external sources.
Detect 58% more threats with fresh intelligence from 16K+ organizations. Integrate TI Feeds in you SOC