/

CVE-2026-85061

Severity:

CRITICAL RISK

(10.0)

DOM-Based XSS (CWE-79) in MapLibre GL JS Attribution UI

CVE-2026-85061

Deferred

Vulnerability type

Category:

Cross-Site Scripting

CWE:

CWE-79

Impact:

Arbitrary JavaScript execution in the victim's browser

Severity:

CRITICAL RISK

(10.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A DOM-based cross-site scripting vulnerability in MapLibre GL JS can allow a dangerous event-handler attribute to bypass attribution sanitization. If an attacker controls an untrusted style attribution or custom attribution string, script may execute when a victim renders the affected map.

Affected context

The issue occurs in MapLibre GL JS attribution controls when untrusted attribution content is sanitized before being inserted into the page with innerHTML. It is relevant where third-party styles or user-supplied custom attributions can contain consecutive dangerous attributes and a victim loads the resulting map content.

Exploit preconditions

  • Attack surface: Browser-side attribution rendering in MapLibre GL JS
  • Required access: Ability to control or influence a style attribution string or custom attribution value
  • Trigger point: Rendering the attribution control and inserting sanitized content into the DOM
  • Victim interaction: A victim must load or otherwise render the affected map content
  • Why exploitation is possible: DOM.sanitize() iterates a live NamedNodeMap while removing attributes, allowing an adjacent dangerous attribute to be skipped

Why this happens

The vulnerability results from modifying a live DOM attribute collection while iterating over it by index. When removeAttributes() deletes an attribute from the same collection being traversed, later attributes shift positions and an adjacent dangerous attribute may not be inspected. This insecure sanitization pattern maps to CWE-79: Improper Neutralization of Input During Web Page Generation, because attacker-influenced markup can reach an HTML insertion sink without reliable neutralization.

Potential impact

  • Arbitrary JavaScript execution in a victim's browser
  • Theft of accessible application data or session information
  • Unauthorized actions performed in the victim's authenticated context
  • Defacement or manipulation of map-related interface content
  • Exposure of other data available to the affected web application

General mitigation guidance

Mitigation generally focuses on making DOM sanitization independent of mutable collections and reducing trust in attribution content.

Common defensive patterns include:

  • Use a proven HTML sanitization mechanism with a strict allowlist for elements and attributes
  • Avoid inserting untrusted attribution content through innerHTML when text-only rendering is sufficient
  • Snapshot or safely traverse attribute collections before removing entries
  • Explicitly reject event-handler attributes and other executable markup
  • Treat third-party style metadata and custom attributions as untrusted input
  • Apply a restrictive Content Security Policy as defense in depth
  • Limit the privileges and sensitive data available to pages that render external map content

How teams detect issues like this

Organizations can detect similar issues through:

  • Static analysis rules for innerHTML and other HTML insertion sinks
  • Code review checks for sanitizers that mutate live DOM collections during iteration
  • Tests containing adjacent dangerous attributes and mixed benign and dangerous markup
  • Browser security testing that verifies event-handler attributes cannot survive sanitization
  • Dependency and policy checks for vulnerable client-side libraries
  • Content Security Policy violation monitoring and browser telemetry

Automated security review tools may help identify unsafe DOM sinks and incomplete sanitization logic, but should be supplemented with focused behavioral tests.

Sources

SourceLink
github.comgithub.com/maplibre/maplibre-gl-js/commit/1da69f3cd913a39fa948708e01478663bf48bc27
github.comgithub.com/maplibre/maplibre-gl-js/pull/8189
github.comgithub.com/maplibre/maplibre-gl-js/releases/tag/v6.4.1
github.comgithub.com/maplibre/maplibre-gl-js/security/advisories/GHSA-jrc7-96c5-q579

Frequently asked

questions

It can be triggered through web content when an attacker controls an attribution value and a victim renders the associated map. It does not generally require direct network access to the victim's browser.

The attacker must be able to influence a third-party style attribution or user-supplied custom attribution that reaches the affected rendering path.

Use strict, well-tested allowlist sanitization, avoid HTML insertion for text-only content, and ensure sanitizers do not mutate live collections while traversing them.

Treat all attribution and metadata strings as untrusted, test sanitization against adjacent malicious attributes, review DOM sinks, and enforce browser-side defense-in-depth policies such as Content Security Policy.

Find out what's already
exploitable in your codebase.