CVE-2026-40890: github.com/gomarkdown/markdown: Out-of-bounds Read in SmartypantsRenderer
Summary
Processing a malformed input containing a < character that is not followed by a > character anywhere in the remaining text with a SmartypantsRenderer will lead to Out of Bounds read or a panic.
Details
The smartLeftAngle() function in html/smartypants.go:367-376 performs an out-of-bounds slice operation when processing a < character that is not followed by a > character anywhere in the remaining text. https://github.com/gomarkdown/markdown/blob/37c66b85d6ab025ba67a73ba03b7f3ef55859cca/html/smartypants.go#L367-L376 If the length of the slice is lower than its capacity, this leads to an extra byte of data read. If the length equals the capacity, this leads to a panic.
PoC golang package main
import ( "bytes" "fmt"
"github.com/gomarkdown/markdown/html" )
func main() { src := []byte("<a")
fmt.Printf("Input: %q (len=%d, cap=%d)\n", src, len(src), cap(src))
var buf bytes.Buffer sp := html.NewSmartypantsRenderer(html.Smartypants) sp.Process(&buf, src) // panics: slice bounds out of range
fmt.Printf("Output: %q\n", buf.String()) }
Impact This vulnerability will lead to a Denial of Service / panic on the processing service.
-- The Datadog Security Team
Other sources
github.com/gomarkdown/markdown: Out-of-bounds Read in SmartypantsRenderer
— Microsoft
The package github.com/gomarkdown/markdown is a Go library for parsing Markdown text and rendering as HTML. Processing a malformed input containing a character that is not followed by a character anywhere in the remaining text with a SmartypantsRenderer will lead to Out of Bounds read or a panic. This vulnerability is fixed with commit 759bbc3e32073c3bc4e25969c132fc520eda2778.
— IBM
The package github.com/gomarkdown/markdown is a Go library for parsing Markdown text and rendering as HTML. Processing a malformed input containing a < character that is not followed by a > character anywhere in the remaining text with a SmartypantsRenderer will lead to Out of Bounds read or a panic. This vulnerability is fixed with commit 759bbc3e32073c3bc4e25969c132fc520eda2778.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/gomarkdown/markdownto a version that resolves this vulnerability.Fixed in 0.0.0-20260411013819-759bbc3e3207 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.22.3-21 - Upgrade
Upgrade
github.com/gomarkdown/markdownto a version that resolves this vulnerability.Patch 759bbc3e32073c3bc4e25969c132fc520eda2778
Event History
Frequently Asked Questions
What is the severity of CVE-2026-40890?
CVE-2026-40890 is classified as a high severity vulnerability due to the potential for Out-of-bounds read leading to application panics.
How do I fix CVE-2026-40890?
To fix CVE-2026-40890, you should upgrade to the version 0.0.0-20260411013819-759bbc3e3207 of the gomarkdown/markdown package.
What types of systems are affected by CVE-2026-40890?
CVE-2026-40890 affects systems using specific versions of the gomarkdown/markdown package and others that utilize it in their implementations.
What kind of input triggers the vulnerability in CVE-2026-40890?
The vulnerability in CVE-2026-40890 is triggered by processing malformed input that contains a '<' character not followed by a '>' character.
Is there any workaround for CVE-2026-40890 until a fix is applied?
Until a fix is applied for CVE-2026-40890, avoid processing potentially malicious input to mitigate the risk of exploitation.