Page MenuHomePhabricator

CVE-2025-62701: Stored XSS through system messages in Wikistories
Closed, ResolvedPublicSecurity

Authored By
SomeRandomDeveloper
Jul 26 2025, 3:49 PM
Referenced Files
F65689093: T400545.patch
Jul 29 2025, 2:11 PM
F65677460: T400545.patch
Jul 26 2025, 3:56 PM
F65677442: image.png
Jul 26 2025, 3:49 PM
F65677416: image.png
Jul 26 2025, 3:49 PM
F65677396: image.png
Jul 26 2025, 3:49 PM

Description

In the Wikistories extension, multiple system messages are inserted as raw HTML, allowing for stored XSS.

wikistories-story-selecttext

Reproduction

  1. Install Wikistories as described in https://www.mediawiki.org/wiki/Extension:Wikistories#Install and https://www.mediawiki.org/wiki/Extension:Wikistories#Running_locally
  2. Edit MediaWiki:Wikistories-story-selecttext to <img src="" onerror="alert('wikistories-story-selecttext')">
  3. Go to /wiki/Special:StoryBuilder/Main_Page
  4. Select any image
  5. Click the blue ">" button

image.png (407×150 px, 11 KB)

Cause

The system message is retrieved using the text output mode and then inserted as raw HTML using v-html:
https://gerrit.wikimedia.org/g/mediawiki/extensions/Wikistories/+/5907351fd2a971ab9839391bf93a3caf3766c5e5/resources/ext.wikistories.builder/components/StoryTextbox.vue#32

wikistories-story-edittext-duplicate

Reproduction

  1. Install Wikistories as described in https://www.mediawiki.org/wiki/Extension:Wikistories#Install and https://www.mediawiki.org/wiki/Extension:Wikistories#Running_locally
  2. Edit MediaWiki:Wikistories-story-edittext-duplicate to <img src="" onerror="alert('wikistories-story-edittext-duplicate')">
  3. Go to /wiki/Special:StoryBuilder/Main_Page
  4. Select any image
  5. Click the blue ">" button
  6. Click "Select story text from Wikipedia"
  7. Select any text on the main page, for example "Community portal – The central hub for editors, with resources, links, tasks, and announcements."
  8. Click "Add to story"
  9. Click the "+" button at the bottom right corner of the image
  10. Select any image
  11. Click the blue ">" button
  12. Click "Select story text from Wikipedia"
  13. Select the same text you selected in step 7
  14. Click "Add to story"

image.png (430×170 px, 8 KB)

Cause

The message is retrieved through mw.msg(), implicitly using the text output mode:
https://github.com/wikimedia/mediawiki-extensions-Wikistories/blob/5907351fd2a971ab9839391bf93a3caf3766c5e5/resources/ext.wikistories.builder/store/story.js#L186
The message is then inserted as raw HTML using v-html:
https://github.com/wikimedia/mediawiki-extensions-Wikistories/blob/5907351fd2a971ab9839391bf93a3caf3766c5e5/resources/ext.wikistories.builder/components/StoryTextbox.vue#L22

wikistories-story-edittext-outdated

Reproduction

This should also be reproducible without editing the JS, but for convenience, I've used the hack in step 2 to get the warning to show up.

  1. Install Wikistories as described in https://www.mediawiki.org/wiki/Extension:Wikistories#Install and https://www.mediawiki.org/wiki/Extension:Wikistories#Running_locally
  2. Replace if ( frame.outdatedText ) { with if ( true ) { in line 202 of story.js
  3. Edit MediaWiki:Wikistories-story-edittext-outdated to <img src="" onerror="alert('wikistories-story-edittext-outdated')">
  4. Go to /wiki/Special:StoryBuilder/Main_Page
  5. Select any image
  6. Click the blue ">" button
  7. Click "Select story text from Wikipedia"
  8. Select any text on the main page, for example "Community portal – The central hub for editors, with resources, links, tasks, and announcements."
  9. Click "Add to story"

image.png (389×158 px, 17 KB)

Cause

The message is retrieved through mw.msg(), implicitly using the text output mode:
https://github.com/wikimedia/mediawiki-extensions-Wikistories/blob/5907351fd2a971ab9839391bf93a3caf3766c5e5/resources/ext.wikistories.builder/store/story.js#L204
The message is then inserted as raw HTML using v-html:
https://github.com/wikimedia/mediawiki-extensions-Wikistories/blob/5907351fd2a971ab9839391bf93a3caf3766c5e5/resources/ext.wikistories.builder/components/StoryTextbox.vue#L22

Additional information

Event Timeline

Patch:


All of the three messages contain spans with classes and we should therefore be able to just parse them using jQueryMsg.

+1 CR, we will look to get it deployed today

sbassett changed the task status from Open to In Progress.Jul 28 2025, 4:58 PM
sbassett triaged this task as Medium priority.
sbassett moved this task from Incoming to Security Patch To Deploy on the Security-Team board.
sbassett added a project: SecTeam-Processed.

Patch:


All of the three messages contain spans with classes and we should therefore be able to just parse them using jQueryMsg.

deployed

Forgot to mention the task in the commit message, updated patch for when this is pushed through gerrit when the supplemental is being released:

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

[mediawiki/extensions/Wikistories@master] SECURITY: Parse system messages before inserting as HTML

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

Change #1189178 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@master] SECURITY: Parse system messages before inserting as HTML

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

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

[mediawiki/extensions/Wikistories@REL1_44] SECURITY: Parse system messages before inserting as HTML

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

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

[mediawiki/extensions/Wikistories@REL1_43] SECURITY: Parse system messages before inserting as HTML

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

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

[mediawiki/extensions/Wikistories@REL1_39] SECURITY: Parse system messages before inserting as HTML

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

Change #1189219 abandoned by Reedy:

[mediawiki/extensions/Wikistories@REL1_39] SECURITY: Parse system messages before inserting as HTML

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

Change #1189217 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@REL1_44] SECURITY: Parse system messages before inserting as HTML

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

Change #1189218 merged by jenkins-bot:

[mediawiki/extensions/Wikistories@REL1_43] SECURITY: Parse system messages before inserting as HTML

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

Mstyles renamed this task from Stored XSS through system messages in Wikistories to CVE-2025-62701: Stored XSS through system messages in Wikistories.Oct 21 2025, 5:32 AM
Mstyles changed the visibility from "Custom Policy" to "Public (No Login Required)".
Mstyles changed the edit policy from "Custom Policy" to "All Users".