Page MenuHomePhabricator

CVE-2025-11937: Stored XSS through a system message in SecurePoll
Closed, ResolvedPublicSecurity

Description

The securepoll-translation-select-import-source-api system message is inserted as raw HTML by the SecurePoll extension, allowing for stored XSS.

Reproduction steps

  1. Make sure $wgUseXssLanguage is set to true
  2. Create a poll
  3. Go to /wiki/Special:SecurePoll/translate/1?uselang=x-xss
  4. Click the blue import button

image.png (563×376 px, 30 KB)

Cause

The message is retrieved in the plain() output mode and inserted as raw HTML through an HtmlSnippet:
https://gerrit.wikimedia.org/g/mediawiki/extensions/SecurePoll/+/52c7942f243c39f6a2ab332fc0125659e6c78d8d/modules/ext.securepoll.htmlform/translation/pages/SelectSourcePage.js#9

Additional information

Details

Author Affiliation
Wikimedia Communities
Related Changes in Gerrit:

Event Timeline

-1 on the patch.

The original link in the i18n message has target="_blank" specifically so that clicking on it would open the link in a new tab. The new definition does not include this. I think we shouldn't change that through a security patch in case it was deliberately intended.


If the approach of your patch doesn't allow the above, we can always fix this by defining the message in RawHtmlMessages of extension.json. That would address the security concern by making the message need elevated permissions to edit on the site.

Apart from building the anchor element dynamically, which would require the URL to be hardcoded or extracted to a new message (which in turn could cause another XSS through javascript: links that would have to be avoided), I think adding it to RawHtmlMessages is the best solution for now. This could probably later be fixed in a non-security follow-up patch.

New patch:

Patch:

+2

Works locally for me (I needed to restart my wiki to get the patch to work in case anyone else is testing this):

image.png (532×223 px, 17 KB)

sbassett changed the task status from Open to In Progress.Aug 18 2025, 5:02 PM
sbassett triaged this task as Low priority.
sbassett added a project: SecTeam-Processed.

Patch:

+2

Works locally for me (I needed to restart my wiki to get the patch to work in case anyone else is testing this):

image.png (532×223 px, 17 KB)

Deployed

Given the size of the QA queue and the low risk that this security issue presents (due to needing at least admin rights to abuse this + comparing to other more important security issues), I think this can skip QA.

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

[mediawiki/extensions/SecurePoll@master] SECURITY: Parse message instead of inserting it as HTML

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

Change #1189186 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] SECURITY: Parse message instead of inserting it as HTML

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

Mstyles renamed this task from Stored XSS through a system message in SecurePoll to CVE-2025-11937: Stored XSS through a system message in SecurePoll.Oct 18 2025, 5:16 AM
Mstyles changed the visibility from "Custom Policy" to "Public (No Login Required)".
Mstyles changed the edit policy from "Custom Policy" to "All Users".

Patch:

+2

Works locally for me (I needed to restart my wiki to get the patch to work in case anyone else is testing this):

image.png (532×223 px, 17 KB)

Question… which patch was +2ed here? Asking because the context of the comments prior to T402076#11094611 would suggest that it maybe might have been intended to be the second version of the patch (ie., the one uploaded in T402076#11093305); but this comment quotes the one that uploaded the first version of the patch — which is now also the one that's been merged in Gerrit.

Patch:

+2

Works locally for me (I needed to restart my wiki to get the patch to work in case anyone else is testing this):

image.png (532×223 px, 17 KB)

Question… which patch was +2ed here? Asking because the context of the comments prior to T402076#11094611 would suggest that it maybe might have been intended to be the second version of the patch (ie., the one uploaded in T402076#11093305); but this comment quotes the one that uploaded the first version of the patch — which is now also the one that's been merged in Gerrit.

That is indeed the wrong patch... unfortunately I think it's too late to undo this now from a security perspective, unless the message would be renamed along with its addition to wgRawHtmlMessages

That is indeed the wrong patch... unfortunately I think it's too late to undo this now from a security perspective, unless the message would be renamed along with its addition to wgRawHtmlMessages

Maybe I'm missing something (in which case I apologise!), but how come it'd be too late to undo? Couldn't e.g. there be a patch pushed to Gerrit which is effectively a combined (a) revert of F65758960 & (b) application of F65774953?

That is indeed the wrong patch... unfortunately I think it's too late to undo this now from a security perspective, unless the message would be renamed along with its addition to wgRawHtmlMessages

Maybe I'm missing something (in which case I apologise!), but how come it'd be too late to undo? Couldn't e.g. there be a patch pushed to Gerrit which is effectively a combined (a) revert of F65758960 & (b) application of F65774953?

If you add the message to wgRawHtmlMessages now, it would in theory be possible for sysops to edit it and insert a payload before their wiki upgrades the extension when the next security/MW release happens (or before the change is deployed via the train on WMF wikis). The only way to avoid that is to rename the message

Ahhh yep. good point. ty @SomeRandomDeveloper.
(On that note though, I wonder if security patches like F65774953 should also rename the message as part of the patch? As otherwise, it seems like such a patch wouldn't remediate the XSS in cases where a sysop without editsitejs had already inserted a payload to the message prior to the security release being made available - e.g. if they'd discovered & exploited the XSS themselves before a fix was released.)


On the subject of this task specifically, I guess it's a question for @Dreamy_Jazz / Product Safety and Integrity as to whether anything more should happen here, bearing in mind the comments in T402076#11093158.