Page MenuHomePhabricator

CVE-2025-7362: Stored XSS through a system message in MsUpload
Closed, ResolvedPublicSecurity

Description

In the MsUpload extension, the msu-continue system message is inserted HTML without proper sanitization.

Reproduction Steps

  1. Make sure the WikiEditor and MsUpload extensions are enabled

Either:

  1. Go to any page and edit it.
  2. Make sure $wgUseXssLanguage is enabled the uselang=x-xss parameter is appended to the end of the URL, e.g. w/index.php?title=Test23523195&action=edit&uselang=x-xss
  3. Drag a file into the "Drop files here" section (called msu-dropzone when using x-xss) that has the same name as a file that is already uploaded onto the wiki

MsUploadReprodMethod1.png (171×437 px, 10 KB)

Or:

  1. Edit MediaWiki:Msu-continue to <script>alert("XSS!")</script>
  2. Edit any article
  3. Drag a file into the "Drop files here" section that has the same name as a file that is already uploaded onto the wiki

MsUploadReprodMethod2.png (193×458 px, 7 KB)

Cause

https://github.com/wikimedia/mediawiki-extensions-MsUpload/blob/53c02fd8cd1f54c94ba2043a91705f3ad5c898ca/resources/MsUpload.js#L184
The msu-continue message is retrieved without sanitization using the text output mode (the shorthand mw.msg() is used here) and provided to the .append() function of jQuery, which appends it to the element as raw HTML.

Event Timeline

SomeRandomDeveloper added a subscriber: Sophivorus.

Patch:


This might cause merge conflicts on <REL1_43 since the file was reformatted in ed003b9.

Not sure how to proceed with these kind of security fixes. Should I adapt and apply that diff to all the branches and merge them directly via "git push" rather than "git review"?

Not sure how to proceed with these kind of security fixes. Should I adapt and apply that diff to all the branches and merge them directly via "git push" rather than "git review"?

I don't think that's possible; since this isn't deployed on WMF, you can upload the patch to gerrit normally, merge it as soon as the tests have ran and then backport the changeset to the other branches. I'll contact someone from Miraheze then who can update the extension. Also note my prior comment about possible merge conflicts on other branches.

Not sure how to proceed with these kind of security fixes. Should I adapt and apply that diff to all the branches and merge them directly via "git push" rather than "git review"?

I don't think that's possible; since this isn't deployed on WMF, you can upload the patch to gerrit normally, merge it as soon as the tests have ran and then backport the changeset to the other branches. I'll contact someone from Miraheze then who can update the extension. Also note my prior comment about possible merge conflicts on other branches.

That's right. If it's for non-Wikimedia-deployed, non-bundled extensions or skins, these can just be pushed through gerrit, and they'll eventually make it into the next supplemental security release (currently T389312). Especially for generally low-risk issues like message XSSes.

Change #1150676 had a related patch set uploaded (by Sophivorus; author: Sophivorus):

[mediawiki/extensions/MsUpload@master] Sanitize message before appending

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

Hi! Well, I sent the diff for review but now Jenkins is complaining about not finding #wpTextbox1 or something. I tried to fix it but failed. I would appreciate any help or guidance on this annoyance. If not, I'll remove Jenkins vote and merge anyway. Cheers!

Change #1150676 merged by jenkins-bot:

[mediawiki/extensions/MsUpload@master] Sanitize message before appending

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

Thanks, that was it. I was testing in REL1_43.

Next I'll backport the fix to 1.44, 1.43, 1.42 and 1.39 (the versions available for download at MsUpload's extension distributor)

Change #1150733 had a related patch set uploaded (by Sophivorus; author: Sophivorus):

[mediawiki/extensions/MsUpload@REL1_44] Sanitize message before appending

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

Change #1150734 had a related patch set uploaded (by Sophivorus; author: Sophivorus):

[mediawiki/extensions/MsUpload@REL1_43] Sanitize message before appending

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

Change #1150733 merged by jenkins-bot:

[mediawiki/extensions/MsUpload@REL1_44] Sanitize message before appending

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

Change #1150734 merged by jenkins-bot:

[mediawiki/extensions/MsUpload@REL1_43] Sanitize message before appending

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

Change #1150735 had a related patch set uploaded (by Sophivorus; author: Sophivorus):

[mediawiki/extensions/MsUpload@REL1_42] Sanitize message before appending

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

Change #1150736 had a related patch set uploaded (by Sophivorus; author: Sophivorus):

[mediawiki/extensions/MsUpload@REL1_39] Sanitize message before appending

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

Change #1150736 merged by jenkins-bot:

[mediawiki/extensions/MsUpload@REL1_39] Sanitize message before appending

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

Change #1150735 merged by jenkins-bot:

[mediawiki/extensions/MsUpload@REL1_42] Sanitize message before appending

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

All done. If someone wants to review this, we can close it. Cheers!

All done. If someone wants to review this, we can close it. Cheers!

Thanks. The Security-Team will open up this bug during our clinic today. And this issue will be re-announced with the next supplemental security release, due out later in June 2025.

sbassett changed the task status from Open to In Progress.May 27 2025, 3:56 PM
sbassett triaged this task as Low priority.
sbassett changed Author Affiliation from N/A to Wikimedia Communities.
sbassett edited projects, added SecTeam-Processed; removed Patch-For-Review.
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 Low.
sbassett moved this task from Incoming to Watching on the Security-Team board.
SomeRandomDeveloper claimed this task.

Closing as this was fixed a while ago and is no longer reproducible.

mmartorana renamed this task from Stored XSS through a system message in MsUpload to CVE-2025-7362: Stored XSS through a system message in MsUpload.Jul 8 2025, 5:28 PM