Page MenuHomePhabricator

CVE-2025-62671: Stored XSS through wikitext in Cargo
Closed, ResolvedPublicSecurity

Description

The Cargo extension is vulnerable to stored XSS through wikitext by inserting malicious HTML into table fields, which are printed out without proper sanitization.

Reproduction steps

  1. Create Template:CargoXSSTemplate with the following contents:
<noinclude>
{{#cargo_declare:_table=TestTable
|Payload=String}}
</noinclude>
<includeonly>
{{#cargo_store:_table=TestTable}}
{|
! XSS Payload
| {{{Payload|}}}
|}
</includeonly>
  1. Go to /w/index.php?title=Template:CargoXSSTemplate&action=recreatedata and click "OK"
  2. Create CargoXSS with the following contents:
{{CargoXSSTemplate|Payload=<script>alert('xss :D')</script>}}
  1. Go to /wiki/Special:Drilldown/TestTable

image.png (284×649 px, 14 KB)

image.png (266×1 px, 65 KB)

Cause

The filter value is not escaped here:
https://github.com/wikimedia/mediawiki-extensions-Cargo/blob/601e7f91939e62985ad649df8edb255d34052478/drilldown/CargoDrilldownPage.php#L350

This string gets passed through a few functions and is then added as HTML:
https://github.com/wikimedia/mediawiki-extensions-Cargo/blob/601e7f91939e62985ad649df8edb255d34052478/drilldown/CargoDrilldownPage.php#L649
https://github.com/wikimedia/mediawiki-extensions-Cargo/blob/601e7f91939e62985ad649df8edb255d34052478/drilldown/CargoDrilldownPage.php#L552
https://github.com/wikimedia/mediawiki-extensions-Cargo/blob/601e7f91939e62985ad649df8edb255d34052478/drilldown/CargoDrilldownPage.php#L1096
https://github.com/wikimedia/mediawiki-extensions-Cargo/blob/601e7f91939e62985ad649df8edb255d34052478/drilldown/CargoDrilldownPage.php#L1342

Callstack:

CargoDrilldownPage.php:350, CargoDrilldownPage->printFilterValue()
CargoDrilldownPage.php:649, CargoDrilldownPage->printFilterValueLink()
CargoDrilldownPage.php:552, CargoDrilldownPage->printUnappliedFilterValues()
CargoDrilldownPage.php:1096, CargoDrilldownPage->printUnappliedFilterLine()
CargoDrilldownPage.php:1342, CargoDrilldownPage->getPageHeader()
QueryPage.php:786, MediaWiki\SpecialPage\QueryPage->execute()
CargoSpecialDrilldown.php:276, CargoSpecialDrilldown->execute()
SpecialPage.php:725, MediaWiki\SpecialPage\SpecialPage->run()
SpecialPageFactory.php:1732, MediaWiki\SpecialPage\SpecialPageFactory->executePath()
ActionEntryPoint.php:499, MediaWiki\Actions\ActionEntryPoint->performRequest()
ActionEntryPoint.php:143, MediaWiki\Actions\ActionEntryPoint->execute()
MediaWikiEntryPoint.php:198, MediaWiki\MediaWikiEntryPoint->run()
index.php:58, {main}()

Additional information

Details

Author Affiliation
Wikimedia Communities
Related Changes in Gerrit:

Event Timeline

Suggested patch:

I am not familiar with the codebase, but this looks like the most obvious solution to me, as the function seems to always return HTML (based on the other return values, which are either HTML elements or parsed messages).

Please use git am to apply this patch before uploading it (alternatively you can ask me to upload it to gerrit), thanks.

Well, if you can upload it yourself to Gerrit, that would be great!

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

[mediawiki/extensions/Cargo@master] SECURITY: Escape filter values

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

Change #1179707 merged by jenkins-bot:

[mediawiki/extensions/Cargo@master] SECURITY: Escape filter values

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

Yaron_Koren added a subscriber: matmarex.

@matmarex - thank you for re-subscribing me!

@SomeRandomDeveloper - thanks for the patch!

I believe this can be closed now.

Mstyles renamed this task from Stored XSS through wikitext in Cargo to CVE-2025-62671: Stored XSS through wikitext in Cargo.Oct 18 2025, 5:02 AM
Mstyles changed the visibility from "Custom Policy" to "Public (No Login Required)".
Mstyles changed the edit policy from "Custom Policy" to "All Users".