Related Vulnerabilities: CVE-2021-29503  

HedgeDoc before version 1.8.2 is vulnerable to a cross-site scripting (XSS) attack using the YAML-metadata of a note. An attacker with write access to a note can embed HTML tags in the Open Graph metadata section of the note, resulting in the frontend rendering the script tag as part of the <head> section. This vulnerability affects all installations. Unless your instance prevents guests from editing notes, this vulnerability allows unauthenticated attackers to inject JavaScript into notes that allow guest edits. If your instance prevents guests from editing notes, this vulnerability allows authenticated attackers to inject JavaScript into any note pages they have write-access to.

Severity High

Remote Yes

Type Cross-site scripting

Description

HedgeDoc before version 1.8.2  is vulnerable to a cross-site scripting (XSS) attack using the YAML-metadata of a note. An attacker with write access to a note can embed HTML tags in the Open Graph metadata section of the note, resulting in the frontend rendering the script tag as part of the <head> section.

This vulnerability affects all installations. Unless your instance prevents guests from editing notes, this vulnerability allows unauthenticated attackers to inject JavaScript into notes that allow guest edits. If your instance prevents guests from editing notes, this vulnerability allows authenticated attackers to inject JavaScript into any note pages they have write-access to.

AVG-1946 hedgedoc 1.8.1-1 1.8.2-1 High Fixed

https://github.com/hedgedoc/hedgedoc/security/advisories/GHSA-gjg7-4j2h-94fq
https://github.com/hedgedoc/hedgedoc/commit/4a0216096a6aa1ebba9d8b0ada067c73ffa1513f

Workaround
==========

In order to prevent unauthenticated attacks in can be useful to disable guest edits until the next update. To do this set the following to configuration options:

{
    # other configs
    # …
     "allowAnonymous": false,
     "allowAnonymousEdits": false,

}

Or set the environment variables CMD_ALLOW_ANONYMOUS=false and CMD_ALLOW_ANONYMOUS_EDITS=false.