Page MenuHomePhabricator

CVE-2025-53487: Stored XSS through system messages in Extension:ApprovedRevs
Closed, ResolvedPublicSecurity

Authored By
SomeRandomDeveloper
May 15 2025, 9:34 AM
Referenced Files
F60015362: T394383.diff
May 15 2025, 1:08 PM
F60007374: image.png
May 15 2025, 9:34 AM
F60007316: image.png
May 15 2025, 9:34 AM
F60007250: image.png
May 15 2025, 9:34 AM
F60007175: image.png
May 15 2025, 9:34 AM
F60007052: image.png
May 15 2025, 9:34 AM
F60006844: image.png
May 15 2025, 9:34 AM

Description

Multiple system messages are inserted into raw HTML without proper sanitization:

approvedrevs-approvedrevision
https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/ApprovedRevsHooks.php#L1315

  1. Upload a file while ApprovedRevs is enabled
  2. Go to the file page and append ?uselang=x-xss to the end of the URL (example URL: http://localhost:4001/wiki/File:TestFile.jpg?uselang=x-xss)

image.png (234×460 px, 8 KB)

approvedrevs-approver
https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/ApprovedRevsHooks.php#L677

  1. Have the viewapprover permission
  2. Create an article in a namespace in which ApprovedRevs is enabled
  3. Go to the revision history of the article and approve the edit you made while creating the page by clicking on the "approve" link after the edit summary
  4. Go to the article you created and make sure that you are visiting it without the oldid parameter set, e.g. /w/index.php?title=ApprovedRevsTest
  5. Append &uselang=x-xss to the end of the URL (example URL: http://localhost:4001/w/index.php?title=ApprovedRevsTest&uselang=x-xss)

image.png (210×456 px, 11 KB)

approvedrevs-noapprovedrevision
This requires $egApprovedRevsShowNotApprovedMessage = true; in LocalSettings.
https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/ApprovedRevsHooks.php#L1229

  1. Add $egApprovedRevsShowNotApprovedMessage = true; to your LocalSettings.php
  2. Create a page in a namespace in which ApprovedRevs is enabled and make sure that no version of the page is approved
  3. Append ?uselang=x-xss to the end of the URL (example URL: http://localhost:4001/wiki/ApprovedRevsTest3?uselang=x-xss)

image.png (232×636 px, 8 KB)

approvedrevs-view
https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/specials/SpecialApprovedRevs.php#L80

  1. To reproduce this vulnerability, the broken import in line 4 (https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/specials/SpecialApprovedRevs.php#L4) has to be changed from MediaWiki\Lineker\Linker to MediaWiki\Linker\Linker.
  2. Go to Special:ApprovedRevs in your wiki and append ?uselang=x-xss to the end of the URL (example URL: http://localhost:4001/wiki/Special:ApprovedRevs?uselang=x-xss)

image.png (205×469 px, 7 KB)

approvedrevs-approvedby
Some date formatting messages like may_long are also inserted here without sanitization.
https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/specials/SpecialApprovedRevs.php#L222

  1. To reproduce this vulnerability, the broken import in line 4 (https://github.com/wikimedia/mediawiki-extensions-ApprovedRevs/blob/bccc58f799c77b3e5b4a17fd49b4d30e6e9981da/includes/specials/SpecialApprovedRevs.php#L4) has to be changed from MediaWiki\Lineker\Linker to MediaWiki\Linker\Linker.
  2. Make sure that there is at least one article in your wiki that has an approved version
  3. Go to Special:ApprovedRevs in your wiki and make sure the show parameter is set to all and the uselang parameter is set to x-xss (example URL: http://localhost:4001/w/index.php?title=Special:ApprovedRevs&show=all&uselang=x-xss)

image.png (214×464 px, 12 KB)

image.png (197×455 px, 23 KB)

Further information
I have tested all of those while being logged in, but most should also work when you're not logged in, depending on the configured user rights.
Browser: Firefox 138.0.1 (64-bit) on Fedora Linux 42
MediaWiki: 1.45.0-alpha (05406ba)
PHP: 8.3.14 (fpm-fcgi)
ApprovedRevs: 2.2.1 (bccc58f) 07:29, 12 May 2025

Event Timeline

Adding BlankEclair since this extension is deployed on Miraheze

Similar to my comment in T394612#10835735, the above patch should likely be pushed through gerrit since it isn't Wikimedia-deployed. Unless Miraheze would like to hold the patch until they've patched their production environments.

Similar to my comment in T394612#10835735, the above patch should likely be pushed through gerrit since it isn't Wikimedia-deployed. Unless Miraheze would like to hold the patch until they've patched their production environments.

We're looking at this now, I also PM'd you on IRC a question.

sbassett added a subscriber: gerritbot.

Change #1147818 merged by jenkins-bot:

[mediawiki/extensions/ApprovedRevs@master] SECURITY: Fixed stored XSS through system messages

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

Change #1147832 had a related patch set uploaded (by Paladox; author: SomeRandomDeveloper):

[mediawiki/extensions/ApprovedRevs@REL1_44] SECURITY: Fixed stored XSS through system messages

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

Change #1147833 had a related patch set uploaded (by Paladox; author: SomeRandomDeveloper):

[mediawiki/extensions/ApprovedRevs@REL1_43] SECURITY: Fixed stored XSS through system messages

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

Change #1147832 merged by jenkins-bot:

[mediawiki/extensions/ApprovedRevs@REL1_44] SECURITY: Fixed stored XSS through system messages

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

Change #1147833 merged by jenkins-bot:

[mediawiki/extensions/ApprovedRevs@REL1_43] SECURITY: Fixed stored XSS through system messages

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

Paladox assigned this task to SomeRandomDeveloper.

Can this be made public / assigned a CVE?

Can this be made public / assigned a CVE?

It's currently in the process of being released with T389312, which should be due out sometime this week. It will get a CVE and be made public during that process.

mmartorana renamed this task from Stored XSS through system messages in Extension:ApprovedRevs to CVE-2025-53487: Stored XSS through system messages in Extension:ApprovedRevs.Jul 8 2025, 5:38 PM
mmartorana changed the visibility from "Custom Policy" to "Public (No Login Required)".