CVE-2026-85061: MapLibre GL JS: XSS Sanitizer Bypass in DOM.sanitize() via Live NamedNodeMap Removal Skip
Impact DOM.sanitize() in src/util/dom.ts iterated elem.attributes (a live NamedNodeMap) while calling elem.removeAttribute() in the same loop. Removing an attribute shifts subsequent attributes down by one index, causing the iterator to skip the adjacent attribute.
An attacker can provide an HTML payload with consecutive dangerous attributes (such as <details open onload="1" ontoggle="...">). The first attribute is stripped while the second survives and executes upon insertion into innerHTML via the attribution control without requiring user interaction (zero-click XSS).
Applications rendering untrusted/third-party style attribution strings or user-supplied custom attributions are impacted.
Patches The issue has been resolved by creating a static snapshot of attributes using Array.from(elem.attributes) before iteration. Please upgrade to maplibre-gl version 6.4.1 (or latest).
Workarounds Sanitizing the attribute field of a source before passing it down to maplibre
Other sources
MapLibre GL JS is an interactive vector tile map library for web browsers. Prior to 6.4.1, DOM.sanitize() in src/util/dom.ts iterates elem.attributes as a live NamedNodeMap while removeAttributes() removes attributes from the same collection, shifting indexes and skipping an adjacent dangerous attribute. An attacker who controls untrusted third-party style attribution strings or user-supplied custom attributions can supply consecutive dangerous attributes, causing an attribute such as onload or ontoggle to survive sanitization and execute when the attribution control inserts the content into innerHTML. A victim must render the affected map content for the script to execute. This issue is fixed in version 6.4.1.
— NVD
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
npm/maplibre-glto a version that resolves this vulnerability.Fixed in 6.4.1 - Upgrade
Upgrade
maplibre-glto a version that resolves this vulnerability.Fixed in 6.4.1
Event History
Frequently Asked Questions
Which applications are realistically exposed to this issue?
Applications using MapLibre GL JS before 6.4.1 are exposed if they render untrusted third-party style attribution strings or user-supplied custom attributions. The issue is triggered when the attribution control inserts that content into innerHTML.
What does an attacker need to exploit the flaw?
An attacker must be able to supply attribution content containing consecutive dangerous attributes. The live attribute collection can shift during sanitization, allowing an adjacent event-handler attribute such as onload or ontoggle to remain.
Is victim interaction required for exploitation?
No explicit user interaction is required, but a victim must render the affected map content. Script execution occurs when the vulnerable attribution content is inserted into the page.
How can I remediate the issue?
Upgrade MapLibre GL JS to version 6.4.1, which fixes the sanitizer iteration issue. Until upgrading, do not allow untrusted third parties or users to provide custom attribution strings, and avoid rendering untrusted style attributions.