The mediasearch-empty-state system message is inserted as raw HTML by the MediaSearch extension, allowing for stored XSS by adding malicious HTML to the message.
Reproduction
- Edit MediaWiki:Mediasearch-empty-state to <img src="" onerror="alert('mediasearch-empty-state')"> (Note that <script> tags do not work here due to the way the HTML is inserted)
- Visit Special:MediaSearch
Cause
mw.msg() returns the message using the text() output mode without escaping any HTML.
https://github.com/wikimedia/mediawiki-extensions-MediaSearch/blob/10530d9a7800784a09c8f062d19bd3269306b193/resources/components/EmptyState.vue#L32-L34
The message is then inserted as raw HTML via v-html:
https://github.com/wikimedia/mediawiki-extensions-MediaSearch/blob/10530d9a7800784a09c8f062d19bd3269306b193/resources/components/EmptyState.vue#L5-L6
