Page MenuHomePhabricator

CVE-2025-7056: Stored XSS through a system message in UrlShortener
Closed, ResolvedPublicSecurity

Description

In the UrlShortener extension, the urlshortener-failed-try-again system message is inserted as HTML without proper sanitization.

Reproduction Steps

  1. Clone UrlShortener, add it to LocalSettings and run update.php
  2. Go to any article in your wiki
  3. Append the ?uselang=x-xss parameter to the end of the url
  4. Open the "Tools" dropdown and click on the entry containing urlshortener-toolbox

image.png (154×470 px, 7 KB)

(Not sure what I did wrong when setting up the extension but this way I got the error message to show up)

Cause

The unsanitized system message is passed into jQuery's .html() function:

https://github.com/wikimedia/mediawiki-extensions-UrlShortener/blob/8a9f6c9c456a662e77ae3677827e19b3af6c05e0/modules/ext.urlShortener.toolbar.js#L89

Event Timeline

The patch looks good to me. I can try to deploy it a bit later.

Patch:

Per https://www.mediawiki.org/wiki/Developing_security_patches#Initial_steps, can you reformat the above patch and post as a correctly-named .patch file with SECURITY: at the beginning of the subject line? Thanks.

Updated patch:


Is it correctly formatted now?

Updated patch:


Is it correctly formatted now?

Yep, CR+1, LGTM.

Mstyles subscribed.

Updated patch:


Is it correctly formatted now?

Yep, CR+1, LGTM.

Deployed

sbassett changed the task status from Open to In Progress.Jun 10 2025, 7:00 PM
sbassett triaged this task as Low priority.

Change #1166269 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/UrlShortener@REL1_44] SECURITY: Insert system message as text instead of html

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

Change #1166270 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/UrlShortener@REL1_43] SECURITY: Insert system message as text instead of html

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

Change #1166271 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/UrlShortener@REL1_42] SECURITY: Insert system message as text instead of html

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

Change #1166272 had a related patch set uploaded (by Jly; author: Jly):

[mediawiki/extensions/UrlShortener@REL1_39] SECURITY: Insert system message as text instead of html

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

Change #1166268 abandoned by Jly:

[mediawiki/extensions/UrlShortener@master] SECURITY: Insert system message as text instead of html

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

Change #1166268 restored by Jly:

[mediawiki/extensions/UrlShortener@master] SECURITY: Insert system message as text instead of html

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

Change #1166272 abandoned by Jly:

[mediawiki/extensions/UrlShortener@REL1_39] SECURITY: Insert system message as text instead of html

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

Change #1166269 merged by jenkins-bot:

[mediawiki/extensions/UrlShortener@REL1_44] SECURITY: Insert system message as text instead of html

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

Change #1166270 merged by jenkins-bot:

[mediawiki/extensions/UrlShortener@REL1_43] SECURITY: Insert system message as text instead of html

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

Change #1166268 merged by jenkins-bot:

[mediawiki/extensions/UrlShortener@master] SECURITY: Insert system message as text instead of html

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

@Jly @sbassett per my comment in T396524#10972019, please make sure to provide attribution when uploading patches I made. There is a number of security patches currently open on Gerrit that were provided by me in the respective tasks, but the author field is set to @Jly and no form of attribution is provided in any way. The ones for this task are already merged without any attribution provided either.

Change #1166271 merged by Jly:

[mediawiki/extensions/UrlShortener@REL1_42] SECURITY: Insert system message as text instead of html

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

@SomeRandomDeveloper Apologies, this was a mistake and has been corrected on all the uploaded patches where possible. I have some error permission with the Quiz extension and have asked a team member to correct the author/attribution.

Jly renamed this task from Stored XSS through a system message in UrlShortener to CVE-2025-7056: Stored XSS through a system message in UrlShortener.Jul 7 2025, 1:52 PM
Jly closed this task as Resolved.
Jly removed a project: Patch-For-Review.

@SomeRandomDeveloper Apologies, this was a mistake and has been corrected on all the uploaded patches where possible. I have some error permission with the Quiz extension and have asked a team member to correct the author/attribution.

Thanks!

sbassett changed Author Affiliation from N/A to Wikimedia Communities.Jul 7 2025, 5:24 PM
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 Low.