The JS implementation for copying button labels to the sticky header in the Vector skin unescapes HTML characters, allowing for stored XSS through system messages.
Reproduction
- Edit any of the affected messages (vector-2022-view-history, nstab-talk, unwatch, vector-2022-view-edit) to the following payload: <img src="" onerror="alert('Sticky Header Button XSS')">.
- Visit any mainspace article in the wiki using the Vector 2022 skin.
Cause
Similarly to T396685, when copying the button labels, the innerHTML of the new element is set to the textContent of the old element: https://github.com/wikimedia/mediawiki-skins-Vector/blob/baac7c4788f174b8e985c7b691fcc159985330f6/resources/skins.vector.js/stickyHeader.js#L66
This unescapes any escaped HTML characters and causes the contents of the system messages to be interpreted as HTML.
