GHSA-9r27-994c-4xch discord-html not escaping HTML code blocks when lacking a language identifier

Not scored Published

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

https://github.com/brussell98/discord-markdown/issues/13

Which versions are affected by GHSA-9r27-994c-4xch?

2 open source packages ship an affected version, including discord-markdown.

PackageAffectedFixed in
discord-markdown npmAll versions2.3.1
discord-markdown npmAll versions2.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.

Sources

Is GHSA-9r27-994c-4xch in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free