CVE-2023-42821 github.com/gomarkdown/markdown Out-of-bounds Read while parsing citations

High 7.5 Published Updated

An attacker can cause a denial of service in applications using the gomarkdown library by providing malformed input when the Mmark extension is enabled.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2023-42821?

CVE-2023-42821 is a high-severity denial of service vulnerability in gomarkdown markdown, published on 22 Sep 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

The package `github.com/gomarkdown/markdown` is a Go library for parsing Markdown text and rendering as HTML. Prior to pseudoversion `0.0.0-20230922105210-14b16010c2ee`, which corresponds with commit `14b16010c2ee7ff33a940a541d993bd043a88940`, parsing malformed markdown input with parser that uses parser.Mmark extension could result in out-of-bounds read vulnerability. To exploit the vulnerability, parser needs to have `parser.Mmark` extension set. The panic occurs inside the `citation.go` file on the line 69 when the parser tries to access the element past its length. This can result in a denial of service. Commit `14b16010c2ee7ff33a940a541d993bd043a88940`/pseudoversion `0.0.0-20230922105210-14b16010c2ee` contains a patch for this issue.

Weakness: CWE-125

Which versions are affected by CVE-2023-42821?

3 open source packages ship an affected version, including github.com/gomarkdown/markdown. It affects 1 product.

PackageAffectedFixed in
github.com/gomarkdown/markdown GoAll versions0.0.0-20230922105210-14b16010c2ee
github.com/gomarkdown/markdown GoAll versions0.0.0-20230922105210-14b16010c2ee
github.com/gomarkdown/markdown GoAll versions0.0.0-20230922105210-14b16010c2ee

Products include Gomarkdown Markdown.

How do I fix CVE-2023-42821?

Upgrade github.com/gomarkdown/markdown to 0.0.0-20230922105210-14b16010c2ee or later.

Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.

Is CVE-2023-42821 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-42821 exists.

Sources

Also known as AZL-39828, CLEANSTART-2026-DC83183, DEBIAN-CVE-2023-42821, GHSA-m9xq-6h2j-65r2, GO-2023-2074, UBUNTU-CVE-2023-42821.

Is CVE-2023-42821 in your software?

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

Check your SBOMs for free