Page MenuHomePhabricator

CVE-2025-61637: Stored XSS through system messages in MW Core
Closed, ResolvedPublicSecurity

Description

The following system messages in MediaWiki Core are vulnerable to stored XSS:

  • preview
  • editlink
  • viewsourcelink

Reproduction Steps

For all of these messages:

  1. Enable "show preview without reloading the page" at Special:Preferences

preview

  1. Go to /w/index.php?title=PreviewXSS&action=edit&uselang=x-xss (or edit any page while using the x-xss language)
  2. Click the preview button

image.png (418×160 px, 6 KB)

Cause: https://github.com/wikimedia/mediawiki/blob/32f306882bbe1de578ff9b4c6c74c10906a2d06c/resources/src/mediawiki.action/mediawiki.action.edit.preview.js#L17 and https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#331

editlink

  1. Edit MediaWiki:Editlink to <script>alert("MW core XSS")</script>
  2. Edit any page
  3. Paste any template invocation into the edit box, e.g. {{SomeTemplate}}. The template does not have to exist on your wiki.
  4. Click "Show preview"

image.png (1,012×943 px, 69 KB)

Cause: https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#215

viewsourcelink

Not sure how to reproduce this, but you need to get a template to be not editable (this needs to be false: https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#196). Then the steps should be almost the same as the ones for editlink.

Cause: https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#215

Additional information

  • MW: 1.45.0-alpha (a98c588)
  • PHP: 8.3.14 (fpm-fcgi)

Event Timeline

Patch suggestion:

I do not have selenium tests set up, so I am unable to fully test this locally.

Thanks @SomeRandomDeveloper for the suggested patch.

Per https://wikitech.wikimedia.org/wiki/How_to_deploy_code#Creating_a_Security_Patch, the patches that are deployed need to be created with a commit message. If you could re-create your patch using the steps specified at that link that would be helpful. Thanks.

The way you created the patch in T394869#10844606 should be good for the above. Thanks.

sbassett changed the task status from Open to In Progress.Jun 10 2025, 7:01 PM
sbassett triaged this task as Low priority.

@sbassett any reason why this was not part of MW 1.43.2? Anybody trying to reproduce T394938: CVE-2025-53494: Stored XSS through a system message in TwoColConflict (which was fixed publicly on gerrit) could easily stumble upon the preview i18n XSS in core as well.

@sbassett any reason why this was not part of MW 1.43.2? Anybody trying to reproduce T394938: CVE-2025-53494: Stored XSS through a system message in TwoColConflict (which was fixed publicly on gerrit) could easily stumble upon the preview i18n XSS in core as well.

Not really sure. I've added it to the tracking task for the next core release. In general, the Security-Team views Message API XSSes as fairly low-risk (we've pushed many of them publicly through gerrit) since one would still need to compromise ifadmin permissions or force something nefarious through translatewiki or gerrit to override system messages like this.

Reedy renamed this task from Stored XSS through system messages in MW Core to CVE-2025-61637: Stored XSS through system messages in MW Core.Sep 29 2025, 1:21 PM

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

[mediawiki/core@REL1_43] SECURITY: Escape three system messages used by live preview

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

Change #1193171 merged by jenkins-bot:

[mediawiki/core@REL1_43] SECURITY: Escape three system messages used by live preview

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

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

[mediawiki/core@REL1_44] SECURITY: Escape three system messages used by live preview

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

Change #1193195 merged by jenkins-bot:

[mediawiki/core@REL1_44] SECURITY: Escape three system messages used by live preview

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

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

[mediawiki/core@master] SECURITY: Escape three system messages used by live preview

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

Change #1193217 merged by jenkins-bot:

[mediawiki/core@master] SECURITY: Escape three system messages used by live preview

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

sbassett changed Author Affiliation from N/A to Wikimedia Communities.Apr 6 2026, 9:16 PM
sbassett removed a project: 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 Watching to Our Part Is Done on the Security-Team board.