Discovered with $wgUseXssLanguage. (See T340201: Use custom language code to find i18n XSS issues)
To reproduce:
- visit Special:Homepage with ?uselang=x-xss
| Michael | |
| Feb 20 2025, 6:26 PM |
| F58441954: T386963.patch | |
| Feb 21 2025, 9:37 AM |
Discovered with $wgUseXssLanguage. (See T340201: Use custom language code to find i18n XSS issues)
To reproduce:
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| SECURITY: Fix XSS in Suggested edits | mediawiki/extensions/GrowthExperiments | master | +1 -1 |
I also tried to check our VisualEditor integration, but that didn't load at all, with the following error:
Uncaught Error: Syntax error, unrecognized expression: [accesskey="<script>alert('accesskey-save')</script>"><script>alert('accesskey-save')</script><x y="()"]Should we have an extra task for that?
Same vulnerability is in growthexperiments-homepage-suggestededits-tasktype-description-*, according to the code.
Probably. That feels like an issue in VisualEditor itself, but I'm unsure if it also has security implications.
I'm a bit surprised that we only adjust the method for the description to parse. Are the others escaped client-side?
That is correct. As far as I can see, only the description is displayed using $( '<p>' ).html( this.taskTypeData.messages.description ). All other parts are displayed using the text() method, for example:
$( tagName ) .addClass( 'suggested-edits-task-explanation-heading' ) .text( this.taskTypeData.messages.name )
Relevant code seems to be modules/ext.growthExperiments.Homepage.SuggestedEdits/TaskExplanationWidget.js.
I wouldn't mind moving the escaping to a single location (all server side or all client side), but that should be probably done in a separate (public) patch.
Thanks! That explanation and the fact that I did not observe any alerts from any of the other message keys is good enough for me. I'm hereby giving a virtual +2 to @Urbanecm_WMF's change.
10:08 <urbanecm> !log Deployed security patch for T386963 10:09 <+stashbot> Logged the message at https://wikitech.wikimedia.org/wiki/Server_Admin_Log
Deployed to production.
@sbassett, is it OK to backport in Gerrit and publish the task?
Change #1122163 had a related patch set uploaded (by Urbanecm; author: Urbanecm):
[mediawiki/extensions/GrowthExperiments@master] SECURITY: Fix XSS in Suggested edits
Change #1122163 merged by jenkins-bot:
[mediawiki/extensions/GrowthExperiments@master] SECURITY: Fix XSS in Suggested edits