MapLibre GL JS: XSS Sanitizer Bypass in DOM.sanitize() via Live NamedNodeMap Removal Skip
Critical severity
GitHub Reviewed
Published
Aug 19, 2026
in
maplibre/maplibre-gl-js
•
Updated Sep 8, 2026
Description
Published by the National Vulnerability Database
Sep 3, 2026
Published to the GitHub Advisory Database
Sep 8, 2026
Reviewed
Sep 8, 2026
Last updated
Sep 8, 2026
Impact
DOM.sanitize()insrc/util/dom.tsiteratedelem.attributes(a liveNamedNodeMap) while callingelem.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 intoinnerHTMLvia 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 tomaplibre-glversion 6.4.1 (or latest).Workarounds
Sanitizing the attribute field of a source before passing it down to maplibre
References