GHSA-9r27-994c-4xch discord-html not escaping HTML code blocks when lacking a language identifier
An attacker can inject malicious HTML into pages using discord-markdown by submitting user-generated markdown without a language identifier.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is GHSA-9r27-994c-4xch?
GHSA-9r27-994c-4xch is a cross-site scripting vulnerability in discord-markdown, published on 24 Feb 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Impact
Any website using discord-markdown with user-generated markdown is vulnerable to having code injected into the page where the markdown is displayed.
Patches
This has been patched in version 2.3.1
Workarounds
Escape the characters <>& before sending plain code blocks to discord-markdown.
References
Which versions are affected by GHSA-9r27-994c-4xch?
2 open source packages ship an affected version, including discord-markdown.
| Package | Affected | Fixed in |
|---|---|---|
discord-markdown npm | All versions | 2.3.1 |
discord-markdown npm | All versions | 2.3.1 |
How do I fix GHSA-9r27-994c-4xch?
Upgrade discord-markdown to 2.3.1 or later.
Escape output for the context it lands in and set a strict Content Security Policy. Upgrading the affected component is the real fix. More about Cross-site scripting.
Is GHSA-9r27-994c-4xch being exploited?
There is no known exploitation of GHSA-9r27-994c-4xch in the wild and no public exploit code.