Page MenuHomePhabricator

CVE-2025-62664: Stored XSS through a system message in ImageRating
Closed, ResolvedPublicSecurity

Description

The imagerating-category system message is inserted as HTML by the ImageRating extension, allowing for stored XSS.

Reproduction

  1. Enable VoteNY and ImageRating
  2. Upload a file
  3. Add <vote type=1 /> to the file page
  4. Vote for the file
  5. Make sure $wgUseXssLanguage is set to true
  6. Go to /wiki/Special:ImageRating?uselang=x-xss
  7. Enter any valid category name (doesn't have to exist) into the textbox next to the image you just rated and click the button under the text box

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

Cause

The result of mw.msg(), which returns system messages unescaped, is passed to the .html() function of jQuery, causing the message contents to be inserted as raw HTML.

https://github.com/wikimedia/mediawiki-extensions-ImageRating/blob/4196049eae8c6bf93b725db847beb82fbc2a19fb/resources/js/ImageRating.js#L39

Additional information

  • MediaWiki: 1.45.0-alpha (16de043)
  • VoteNY: d9c13f3
  • ImageRating: 4196049

Event Timeline

Patch:

(I was not able to test this due to the aforementioned issues. However, the message doesn't seem to include any HTML which would have to be converted to wikitext and parsed, so just using .text() should be sufficient here)

Patch:

LGTM, nice catch! 👍

I wonder in how many other extensions you can find the same flaw... 🤔

Patch:

LGTM, nice catch! 👍

Would you be able to +2 it if I uploaded it to gerrit shortly?

Patch:

LGTM, nice catch! 👍

Would you be able to +2 it if I uploaded it to gerrit shortly?

Sure, go ahead, please!

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

[mediawiki/extensions/ImageRating@master] SECURITY: Insert system messages as text instead of HTML

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

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

[mediawiki/extensions/ImageRating@REL1_44] SECURITY: Insert system messages as text instead of HTML

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

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

[mediawiki/extensions/ImageRating@REL1_43] SECURITY: Insert system messages as text instead of HTML

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

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

[mediawiki/extensions/ImageRating@REL1_39] SECURITY: Insert system messages as text instead of HTML

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

Change #1179116 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@REL1_39] SECURITY: Insert system messages as text instead of HTML

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

Change #1179115 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@REL1_43] SECURITY: Insert system messages as text instead of HTML

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

Change #1179114 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@REL1_44] SECURITY: Insert system messages as text instead of HTML

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

Thanks for merging! I added reproduction steps based on the steps suggested in T401998#11089373, and was able to reproduce the vulnerability on the commit before my patch, and could no longer reproduce it with my patch.

Change #1179113 merged by jenkins-bot:

[mediawiki/extensions/ImageRating@master] SECURITY: Insert system messages as text instead of HTML

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

sbassett changed the task status from Open to In Progress.Aug 18 2025, 4:31 PM
sbassett triaged this task as Low priority.
sbassett moved this task from Incoming to Watching on the Security-Team board.
sbassett edited projects, added: SecTeam-Processed; removed: Patch-For-Review.
sbassett subscribed.

Thanks!

Closing as the fix was merged and backported.

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