Reproduce
{{#tag:pre|CLICK pre|data-/onclick=alert("鬼影233")}}
{{#categorytree:CLICK categorytree|data-/onclick=alert("向世界问好")}}On the MediaWiki, Wikipedia, and most other wiki sites, preview and click on these. Expected to see the alert message.
Research
Sanitizer::validateAttributes and Sanitizer::validateTagAttributes (Sanitizer.php#L510-L520) Expected to clean up attributes. However, attributes beginning with data- will almost completely bypass the cleanup.
This simple vulnerability can be reproduced in the latest and sufficiently old versions (such as 1.38.6).
Credits
@gui-ying233 (Reporter): Discovered this vulnerability in a custom extension.
@Func & @dragon-fish: Help identify, locate, test this vulnerability, and provide more examples of its exploitation.
BTW
Sorry, I'm not good at PHP or English. And if possible, I would like to be added to the Hall of Fame.