Page MenuHomePhabricator

CVE-2025-53500: Stored XSS through system messages in MassEditRegex
Closed, ResolvedPublicSecurity

Description

The masseditregex-before and masseditregex-after system messages are inserted into raw HTML by the MassEditRegex extension, allowing for stored XSS by inserting malicious HTML into the messages.

Reproduction steps

  • Clone https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MassEditRegex/+/1160772 to get the extension working on MW >1.44, or use an MW version between 1.40-1.43 for testing this
  • Edit MediaWiki:Masseditregex-before to Before<script>alert('before')</script>
  • Edit MediaWiki:Masseditregex-after to After<script>alert('after')</script>
  • Go to Special:MassEditRegex, enter any existing page into the "Pages to edit:" field and click "Show preview"

image.png (168×424 px, 6 KB)

image.png (176×424 px, 9 KB)

Cause

The system messages are retrieved using the text output mode, which does not sanitize them, concatenated with HTML and inserted into diffEngine->getDiff via the $otitle and $ntitle parameters, which are inserted as raw HTML.

Additional information

Event Timeline

Patch (on top of https://gerrit.wikimedia.org/r/c/mediawiki/extensions/MassEditRegex/+/1160772 which should be merged and backported to REL1_44 first; the security patch might not apply without conflicts on REL1_42 and REL1_43):

MassEditRegex does not appear to be bundled or Wikimedia-deployed, so the patch can get pushed through gerrit and we'll add it to the supplemental release once it's merged.

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

[mediawiki/extensions/MassEditRegex@master] SECURITY: Escape system messages in diff headers

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

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

[mediawiki/extensions/MassEditRegex@REL1_44] SECURITY: Escape system messages in diff headers

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

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

[mediawiki/extensions/MassEditRegex@REL1_43] SECURITY: Escape system messages in diff headers

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

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

[mediawiki/extensions/MassEditRegex@REL1_42] SECURITY: Escape system messages in diff headers

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

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

[mediawiki/extensions/MassEditRegex@REL1_39] SECURITY: Escape system messages in diff headers

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

Change #1163878 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@master] SECURITY: Escape system messages in diff headers

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

Change #1163879 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@REL1_44] SECURITY: Escape system messages in diff headers

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

Change #1163880 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@REL1_43] SECURITY: Escape system messages in diff headers

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

Change #1163882 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@REL1_39] SECURITY: Escape system messages in diff headers

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

Change #1163881 merged by jenkins-bot:

[mediawiki/extensions/MassEditRegex@REL1_42] SECURITY: Escape system messages in diff headers

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

Merged and backported to 1.44, 1.43, 1.42 and 1.39.

Jly renamed this task from Stored XSS through system messages in MassEditRegex to CVE-2025-53500: Stored XSS through system messages in MassEditRegex.Jun 30 2025, 7:27 PM
Jly changed the visibility from "Custom Policy" to "Public (No Login Required)".
Jly changed the edit policy from "Custom Policy" to "All Users".
Jly changed Risk Rating from N/A to Low.