Page MenuHomePhabricator

CVE-2026-58519: Stored XSS through Cargo's map format
Closed, ResolvedPublicSecurity

Description

It's possible to perform stored XSS through wikitext by abusing Cargo's map format.

Reproduction steps

  1. Create Template:XSS with {{#cargo_declare:_table=XSS|lat=Lat|lon=Lon}}
  2. Create the table for Template:XSS
  3. Create another page with the following contents:
== XSS ==

<div class="mapCanvas olMap" style="height: 400px; width: 100%;" id="mapCanvas1">
<span class="cargoMapData" style="display: none" data-mapping-service="OpenLayers">[{"name":1,"title":"<img src=x onerror=alert(1)>","lat":1,"lon":2,"otherValues":{}}]</span>
</div>

== Real Map ==

{{#cargo_store:_table=XSS|lat=1|lon=1}}
{{#cargo_query:
|tables=XSS
|fields=lat,lon
|format=map
}}
  1. Click on the marker in the first map

image.png (864×449 px, 21 KB)

Cause

Cargo stores the JSON for the map inside a <span>, which can be replicated through wikitext.
In addition to that, the existing span can also be modified using the language converter.

Additional information

MW: 1.46.0-alpha (4dc13a1)
Cargo: 3.9 (ee74846)

Details

Risk Rating
Medium
Author Affiliation
Wikimedia Communities
Related Changes in Gerrit:

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

This patch stores the map data in the data-mw-cargo-map-data attribute instead of the element's contents, and ignores all .cargoMapData elements that don't have the attribute. This way, users cannot create fake map data elements, and as the data is in the attribute, it won't be modified by the language converter.

Can just go through gerrit and have Yaron review it there.

Can just go through gerrit and have Yaron review it there.

There are other wiki / wiki farm operators using Cargo, which @Yaron_Koren usually adds to the task to give them time to patch the vulnerability. But yes, after that. I can upload it to gerrit

@SomeRandomDeveloper - thank you for finding this issue, as well as the fix for it. I have added some subscribers to this task.

Change #1277612 had a related patch set uploaded (by SomeRandomDeveloper; author: SomeRandomDeveloper):

[mediawiki/extensions/Cargo@master] SECURITY: Use a reserved data attribute to store map data

https://gerrit.wikimedia.org/r/1277612

Change #1277612 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] SECURITY: Use a reserved data attribute to store map data

https://gerrit.wikimedia.org/r/1277612

sbassett triaged this task as Medium priority.May 5 2026, 6:13 PM
sbassett changed the visibility from "Custom Policy" to "Public (No Login Required)".
sbassett changed the edit policy from "Custom Policy" to "All Users".
sbassett changed Risk Rating from N/A to Medium.
Mstyles renamed this task from Stored XSS through Cargo's map format to CVE-2026-58519: Stored XSS through Cargo's map format.Jul 1 2026, 3:59 AM