HedgeDoc is a collaborative platform for writing and sharing markdown. In HedgeDoc before version 1.7.1 an attacker can inject arbitrary script
tags in HedgeDoc notes using mermaid diagrams. Our content security policy prevents loading scripts from most locations, but www.google-analytics.com
is allowed. Using Google Tag Manger it is possible to inject arbitrary JavaScript and execute it on page load. Depending on the configuration of the instance, the attacker may not need authentication to create or edit notes. The problem is patched in HedgeDoc 1.7.1. As a workaround one can disallow www.google-analytics.com
in the Content-Security-Policy
header. Note that other ways to leverage the script
tag injection might exist.
github.com/Alemmi/ctf-writeups/blob/main/hxpctf-2020/hackme/solution.md
github.com/hackmdio/codimd/issues/1630
github.com/hedgedoc/hedgedoc/commit/58276ebbf4504a682454a3686dcaff88bc1069d4
github.com/hedgedoc/hedgedoc/releases/tag/1.7.1
github.com/hedgedoc/hedgedoc/security/advisories/GHSA-g6w6-7xf9-m95p