In the ExternalGuidance extension, the externalguidance-machine-translation-heading and externalguidance-machine-translation-contribute system messages are inserted as HTML without proper sanitization.
Reproduction
- Install ExternalGuidance
- Go to /w/index.php?title=Main_Page&uselang=x-xss
- Run the following JS in the browser console (there is barely any documentation on how the extension works, so I just used this to manually load the module with minimal configuration):
mw.loader.using( [ 'mw.externalguidance' ] ).then( ( req ) => { const ExternalGuidance = req( 'mw.externalguidance' ); const eg = new ExternalGuidance( 'machine-translation', {service: 'Google', to: 'de'} ); eg.init(); } );
Cause
The result of mw.msg(), which returns messages unsanitized, is passed to .html(), which inserts the message contents as raw HTML:
https://gerrit.wikimedia.org/g/mediawiki/extensions/ExternalGuidance/+/7584a17bb7f10f4622caf070a075d9daf4e24c62/modules/mw.externalguidance/core.js#61
https://gerrit.wikimedia.org/g/mediawiki/extensions/ExternalGuidance/+/7584a17bb7f10f4622caf070a075d9daf4e24c62/modules/mw.externalguidance/core.js#111


