The following system messages in MediaWiki Core are vulnerable to stored XSS:
- preview
- editlink
- viewsourcelink
Reproduction Steps
For all of these messages:
- Enable "show preview without reloading the page" at Special:Preferences
preview
- Go to /w/index.php?title=PreviewXSS&action=edit&uselang=x-xss (or edit any page while using the x-xss language)
- Click the preview button
Cause: https://github.com/wikimedia/mediawiki/blob/32f306882bbe1de578ff9b4c6c74c10906a2d06c/resources/src/mediawiki.action/mediawiki.action.edit.preview.js#L17 and https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#331
editlink
- Edit MediaWiki:Editlink to <script>alert("MW core XSS")</script>
- Edit any page
- Paste any template invocation into the edit box, e.g. {{SomeTemplate}}. The template does not have to exist on your wiki.
- Click "Show preview"
viewsourcelink
Not sure how to reproduce this, but you need to get a template to be not editable (this needs to be false: https://gerrit.wikimedia.org/g/mediawiki/core/+/e92731f51cc912edd36f12adb86913d534ddb19a/resources/src/mediawiki.page.preview.js#196). Then the steps should be almost the same as the ones for editlink.
Additional information
- MW: 1.45.0-alpha (a98c588)
- PHP: 8.3.14 (fpm-fcgi)

