The following system messages are inserted as raw HTML by the watchlist editing dialog in MW Core:
- watchlistlabels-editwatchlist-dialog-intro-noitems
- watchlistlabels-editwatchlist-dialog-intro
- watchlistlabels-editwatchlist-dialog-intro-unassign-noitemlabels
- watchlistlabels-editwatchlist-dialog-intro-unassign-noitems
- watchlistlabels-editwatchlist-dialog-intro-unassign
- watchlistedit-unwatch-confirmation
- watchlistedit-unwatch-confirmation-empty
- watchlistlabels-editwatchlist-dialog-intro-more
Reproduction steps
I'm only going to provide reproduction steps for a few messages here since all of them are inserted the same way.
- Add $wgUseXssLanguage = true; and $wgEnableWatchlistLabels = true; to your LocalSettings.php
- Go to /wiki/Special:EditWatchlist?uselang=x-xss
- Click on any of the three buttons
Cause
The dialogBody variable is inserted as HTML using v-html.
https://github.com/wikimedia/mediawiki/blob/e9264452290c25575e1a0b66a26e0b94787b4209/resources/src/mediawiki.special.watchlistedit/EditWatchlistDialog.vue#L27-L29
All of the messages except for one are retrieved using mw.msg( ... ), which is a shorthand syntax for mw.message( ... ).text(), which does not escape the message contents.
https://github.com/wikimedia/mediawiki/blob/e9264452290c25575e1a0b66a26e0b94787b4209/resources/src/mediawiki.special.watchlistedit/EditWatchlistDialog.vue#L115-L140
Since the messages aren't escaped, the parameters aren't either. This is why the watchlistlabels-editwatchlist-dialog-intro-more message is also affected:
https://github.com/wikimedia/mediawiki/blob/e9264452290c25575e1a0b66a26e0b94787b4209/resources/src/mediawiki.special.watchlistedit/EditWatchlistDialog.vue#L161-L165
Fortunately, page titles, which are also passed as parameters, cannot contain angle brackets, so it is likely not possible to abuse this for stored self-XSS.
Additional information
watchlistlabels-editwatchlist-dialog-intro-nolabels, which is the only message that was parsed before this change, cannot actually be parsed because jqueryMsg doesn't support the {{#Special:...}} syntax in messages.
https://github.com/wikimedia/mediawiki/blob/e9264452290c25575e1a0b66a26e0b94787b4209/languages/i18n/en.json#L2222
It will instead log a warning: mediawiki.jqueryMsg: watchlistlabels-editwatchlist-dialog-intro-nolabels: Unknown operation "#special"
(see https://www.mediawiki.org/wiki/Manual:Messages_API#Feature_support_in_JavaScript for more information)
This regression was introduced in https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1235609 and will be deployed through this week's train.
(Filed T417604)
Core version: 1.46.0-alpha (2c7f5b7)
