EasyTimeline does not sanitize URLs before adding them as links to the generated SVG, allowing for stored XSS to be performed if users visit the SVG directly.
Reproduction steps
- Go to https://en.wikipedia.org/wiki/Special:ExpandTemplates?wpInput=%3Ctimeline%3E%0AImageSize%20%3D%20width%3A400%20height%3A150%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%0APlotArea%20%3D%20left%3A50%20right%3A50%20bottom%3A50%20top%3A10%0ADateFormat%20%3D%20yyyy%0APeriod%20%3D%20from%3A2000%20till%3A2010%0ATimeAxis%20%3D%20orientation%3Ahorizontal%0A%0ATextData%20%3D%0A%20%20pos%3A(1.5%2C0.9)%20text%3A%5Bjavascript%3Aalert(%27test%27)%7CClick_me%5D%0A%3C%2Ftimeline%3E (this won't work on testwiki as it has a CSP which prevents inline scripts from being executed (T117618))
- Copy the URL of the generated image and replace .png with .svg
- Visit the SVG (e.g. https://upload.wikimedia.org/wikipedia/en/timeline/46e9y6gya1583ddr1q98xxe7uu2ahfd.svg)
- Click the link in the SVG
Cause
Links are not validated in any way: https://github.com/wikimedia/mediawiki-extensions-timeline/blob/3ff4deb7369c5ae17117d64b678bedfce7a6ad0a/scripts/EasyTimeline.pl#L3263
And then added to the SVG: https://github.com/wikimedia/mediawiki-extensions-timeline/blob/3ff4deb7369c5ae17117d64b678bedfce7a6ad0a/scripts/EasyTimeline.pl#L4137
I assume this was missed because the SVG is not directly served to readers, but that can be bypassed by just visiting it directly.
Additional information
Credits: This vulnerability was discovered by @Andmcadams .


