Page MenuHomePhabricator

CVE-2025-61648: Stored XSS through system messages in CheckUser
Closed, ResolvedPublicSecurity

Description

Multiple system messages are inserted as raw HTML by the CheckUser extension, allowing for stored XSS.

checkuser-tempaccount-specialblock-ips

Reproduction steps

  1. Make sure $wgUseXssLanguage is set to true
  2. Make sure a temporary account exists in the wiki
  3. Make sure you have the relevant permissions to view the IPs of temporary accounts
  4. Go to /wiki/Special:Block?uselang=x-xss
  5. Enter the username of a temporary account into the "Target" field
  6. Click the "Show IP" link below the field

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

Cause

The system message is retrieved unescaped using mw.msg and inserted as HTML via a HtmlSnippet:
https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/SpecialBlock.js#98

checkuser-tempaccount-specialblock-ips

Reproduction steps

  1. Edit MediaWiki:checkuser-tempaccount-specialblock-ips to <img src="" onerror="alert(1)">
  2. Add the following to your LocalSettings.php:
$wgUseCodexSpecialBlock = true;
$wgEnableMultiBlocks = true;
  1. Go to /wiki/Special:Block/~2025-1 (make sure a temp account is selected a s the target)
  2. Click "Show IP"

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

Cause

https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#121
https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#8

checkuser-tempaccount-no-ip-results

Cause

https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#127
https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#8

checkuser-tempaccount-reveal-ip-error

Cause

https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#134
https://gerrit.wikimedia.org/g/mediawiki/extensions/CheckUser/+/e561217388ea1fc581fb573631318c41044517e8/modules/ext.checkUser.tempAccounts/ShowIPButton.vue#8

Additional information

Event Timeline

Thanks for the patch.

An initial comment. As far as I can see, we probably don't need the call to mw.language.listToText inside a function. That isn't blocking though.

I will test the patch locally now.

As far as I can see, we probably don't need the call to mw.language.listToText inside a function. That isn't blocking though.

This is so $ in the replacement string doesn't get interpreted, I've taken this from a similar rawParams substitute in core:
https://gerrit.wikimedia.org/g/mediawiki/core/+/7829c0f433ce6a39035f0bfc0f9556b6f654ec29/resources/src/mediawiki.page.preview.js#40

As far as I can see, we probably don't need the call to mw.language.listToText inside a function. That isn't blocking though.

This is so $ in the replacement string doesn't get interpreted, I've taken this from a similar rawParams substitute in core:
https://gerrit.wikimedia.org/g/mediawiki/core/+/7829c0f433ce6a39035f0bfc0f9556b6f654ec29/resources/src/mediawiki.page.preview.js#40

Sure. I thought that $N isn't interpreted as a regex capture group reference, because Mozilla MDN docs says that:

$n and $<Name> are only available if the pattern argument is a RegExp object. If the pattern is a string, or if the corresponding capturing group isn't present in the regex, then the pattern will be replaced as a literal.

However, there is no harm in using a function anyway.

I would also note that the new Multiblocks Special:Block appears to have the same problem which will also need fixing (and is not fixed through the patch I approved above):

image.png (540×380 px, 36 KB)

That code was added by the Community-Tech team.

Yes, that is the code which looks to be causing this.

Thanks for taking a look at it. You can always create another patch to deploy if the Security-Team has deployed your first patch.

(Will review your other patch when ready. Moving out of our 'Needs review' column to avoid the implication that code needs reviewing now as the original patch has a virtual +2)

Thanks for taking a look at it. You can always create another patch to deploy if the Security-Team has deployed your first patch.

We have not. We can hold off if a more comprehensive patch is in the works.

Updated patch:


("message" should probably be renamed to "messageHtml" so it's clear that it is used as HTML, but this can also be done in a non-security follow-up)

SomeRandomDeveloper renamed this task from Stored XSS through a system message in CheckUser to Stored XSS through system messages in CheckUser.Aug 19 2025, 2:26 PM
SomeRandomDeveloper updated the task description. (Show Details)

Updated patch:


("message" should probably be renamed to "messageHtml" so it's clear that it is used as HTML, but this can also be done in a non-security follow-up)

+2

The above patch was deployed during today's (2025-08-25) security window.

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.

Reedy renamed this task from Stored XSS through system messages in CheckUser to CVE-2025-61648: Stored XSS through system messages in CheckUser.Sep 29 2025, 1:35 PM

Sorry, too many patches to handle. Never mind in my own comment I state that that the rest is valid anyway...

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

[mediawiki/extensions/CheckUser@REL1_44] SECURITY: Escape system messages before inserting them as HTML

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

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

[mediawiki/extensions/CheckUser@master] SECURITY: Escape system messages before inserting them as HTML

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

The patches for both need double checking please, as both had some issues.

Change #1193246 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@REL1_44] SECURITY: Escape system messages before inserting them as HTML

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

Change #1193254 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] SECURITY: Escape system messages before inserting them as HTML

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

sbassett triaged this task as Medium priority.Apr 6 2026, 9:09 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 Medium.