A Wormable XSS on HackMD!
HackMD's Markdown renderer passed HTML comments through its XSS sanitiser unfiltered, so a crafted comment could close early and inject arbitrary markup. Because the site's CSP allowed a public CDN, an attacker could load AngularJS and use client-side template injection to run script, potentially spreading like a worm between collaborators.
blog.orange.tw
Published on blog.orange.tw
在 Web Security 中,我喜歡伺服器端的漏洞更勝於客戶端的漏洞!(當然可以直接拿 shell 的客戶端洞不在此限XD) 因為可以直接控制別人的伺服器對我來說更有趣! 正因如此,我以往的文章對於 XSS 及 CSRF 等相關弱點也較少著墨(仔細翻一下也只有 2018 年 Google CTF 那篇XD),剛好這次的漏洞小小有趣,秉持著教育及炫耀(?)的心� �就來發個文了XD
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
What the attacker needed
Ability to create or edit a note; victim views or co-edits the note; browser loads scripts from the allowed CDN
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
A website that lets people write Markdown must clean the HTML before showing it, otherwise someone can sneak in code that runs in other readers' browsers. Here the cleaning tool was told to leave HTML comments alone, and the author found a way to break out of a comment and add their own tags. A second protection, a browser rule listing which scripts may run, was too permissive and could be worked around.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.