Summary
A stored cross-site scripting vulnerability in the MediaWiki Maps extension allows an editor to place attacker-controlled HTML in a map overlay label. When another user previews or views the affected map, the browser may execute the embedded script within that user's MediaWiki session.
Affected context
The issue occurs in Maps deployments that use the display_map parser function with the Leaflet service. It becomes risky when a user with edit permission can store malicious wikitext in the overlays parameter and the resulting overlay name is rendered as a Leaflet layer-control label without adequate HTML escaping.
Exploit preconditions
- Attack surface: MediaWiki pages containing Maps extension Leaflet maps
- Required access: Permission to edit content that can include the affected map syntax
- Trigger point: Another user previews or views a page containing the affected map
- Why exploitation is possible: Attacker-controlled overlay text is inserted into browser-rendered HTML without sufficient output encoding
Why this happens
The underlying bug is context-inappropriate handling of user-controlled content during client-side HTML rendering. The Leaflet integration uses an overlay name as a layer-control label without escaping it, allowing markup or script-bearing content to become active in the viewer's browser. This behavior maps primarily to CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), with CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page also relevant to the unsafe HTML handling pattern.
Potential impact
- An attacker may execute JavaScript in another user's browser session.
- The script could access data visible to the affected user.
- The script could perform actions permitted by the victim's MediaWiki account.
- Administrative or privileged users could face broader account or site-impacting consequences.
- The vulnerability could facilitate content manipulation, credential abuse, or follow-on attacks.
General mitigation guidance
Mitigation generally focuses on treating map labels and other rendered metadata as untrusted text.
Common defensive patterns include:
- Apply context-appropriate HTML escaping before inserting overlay names into the DOM.
- Prefer text-only DOM APIs or framework mechanisms that do not interpret supplied values as markup.
- Use allowlists and strict schemas for map configuration fields where formatting is genuinely required.
- Reduce the trust granted to users who can create or modify map syntax.
- Apply least privilege to editor and administrative roles to limit the impact of script execution.
- Use browser-side defenses such as an appropriately restrictive Content Security Policy as a defense in depth.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis rules identifying concatenation of user-controlled values into HTML or DOM sinks.
- Code review checks for
innerHTML, HTML-building APIs, template interpolation, or equivalent unsafe rendering patterns. - Tests using markup-like and script-like input in overlay names and other map metadata.
- Content-security and web-application monitoring policies that identify unexpected inline script execution.
- Repository scans and automated security review tools that flag missing output encoding at browser-rendering boundaries.

