Vulnerabilities in pkg:golang/github.com/gomarkdown/markdown
PACKAGECVE-2026-102941 is a HIGH (CVSS 7.5) gomarkdown/markdown issafeurl panics on short vulnerability (CWE-125: Out-of-bounds Read) affecting Github.com/gomarkdown/markdown libraries in the Go ecosystem. The issue involves gomarkdown/markdown issafeurl panics on short urls. Remediation is available by upgrading affected packages to version 0.0.0-20260724235538-61af6e1e6971.
pkg:golang/github.com/gomarkdown/markdown
Vulnerability advisories affecting package pkg:golang/github.com/gomarkdown/markdown. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-cv23-7vc5-jfh7 | CVE-2026-102941 | HIGH | gomarkdown/markdown IsSafeURL panics on short URLs |
| GHSA-77fj-vx54-gvh7 | CVE-2026-40890 | HIGH | Go Markdown has an Out-of-bounds Read in SmartypantsRenderer |
| GHSA-xhr3-wf7j-h255 | CVE-2024-44337 | MODERATE | Infinite loop in github.com/gomarkdown/markdown |
| GHSA-m9xq-6h2j-65r2 | CVE-2023-42821 | HIGH | Markdown vulnerable to Out-of-bounds Read while parsing citations |
CVE-2026-102941 at a Glance
Security Impact
CVSS: 7.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-102941
To remediate this vulnerability, upgrade all affected Github.com/gomarkdown/markdown dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/gomarkdown/markdown to 0.0.0-20260724235538-61af6e1e6971
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/gomarkdown/markdown
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-102941, inspect your project dependencies for Github.com/gomarkdown/markdown:
inspect dependencies for github.com/gomarkdown/markdown
Analyze the terminal output to locate any version of Github.com/gomarkdown/markdown in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.0.0-20260724235538-61af6e1e6971), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-125: Out-of-bounds Read, where the product reads data past the end, or before the beginning, of the intended buffer. In Github.com/gomarkdown/markdown, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-102941 Affected Github.com/gomarkdown/markdown Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/gomarkdown/markdown
|
Go |
< 0.0.0-20260724235538-61af6e1e6971
|
0.0.0-20260724235538-61af6e1e6971
|
References
Frequently Asked Questions
What is CVE-2026-102941?
Which Github.com/gomarkdown/markdown versions are affected?
What version fixes CVE-2026-102941?
Is github.com/gomarkdown/markdown affected?
What is the CVSS score of CVE-2026-102941?
What CWE is associated with CVE-2026-102941?
How can I check Go dependencies for CVE-2026-102941?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-cv23-7vc5-jfh7",
"modified" : "2026-10-16T15:41:39Z",
"published" : "2026-10-16T15:41:39Z",
"aliases" : [ "CVE-2026-102941" ],
"summary" : "gomarkdown/markdown IsSafeURL panics on short URLs",
"details" : "## Summary\n\nIsSafeURL slices url[:nPath] before checking that len(url) >= nPath, so a URL shorter than a path prefix (0, 1 or 2 bytes) triggers a slice-bounds panic, and this is reached end to end when the html.Safelink hardening flag is enabled and the input contains an empty or very short link destination, giving an unrecoverable crash DoS. Confirmed at HEAD (e08cff8; present since 2022).\n\n## The defect\n\nparser/parser.go, IsSafeURL:\n\n```go\nfunc IsSafeURL(url []byte) bool {\n nLink := len(url)\n for _, path := range validPaths { // \"/\", \"./\", \"../\"\n nPath := len(path)\n linkPrefix := url[:nPath] // line 789: sliced BEFORE the length guard\n if nLink >= nPath && bytes.Equal(linkPrefix, path) { // line 790: guard is too late\n ...\n```\n\nurl[:nPath] is evaluated before the `nLink >= nPath` check. When len(url) < nPath and cap(url) < nPath, the slice expression panics. Only the relative-path loop is affected; the adjacent URIs loop is already correctly guarded (the signal that this one deviates, the same signal as the anchor). Input: IsSafeURL(\"\") panics ([:1] cap 0), IsSafeURL(\".\") panics ([:2] cap 1), IsSafeURL(\"..\") panics ([:3] cap 2), while IsSafeURL(\"/\") returns true. End to end: `markdown.ToHTML(input, html.CommonFlags|html.Safelink)` with input `[x]()` panics. Attacker model: (1) any service rendering untrusted Markdown with the html.Safelink flag (the URL-sanitizing hardening flag itself introduces the crash); or (2) any downstream that calls the exported parser.IsSafeURL on a 0/1/2-byte attacker URL, no flag required. No recover() anywhere, so an uncaught crash of the calling goroutine.\n\n## Verification\n\nEXECUTED with negative controls. Direct: the empty/1/2-char cases panic with the exact slice-bounds message while \"/\" returns true. End to end via ToHTML with html.CommonFlags|html.Safelink: `[x]()` panics, while `[x](/)`, `[x](http://example.com)`, plain text, and `[x](javascript:alert(1))` (safely dropped) do not. NOT verified: how many downstream apps enable Safelink or call IsSafeURL directly (the default no-Safelink render path does not reach it).\n\n## Suggested fix\n\nMove the slice inside the guard: check `nLink >= nPath` first, then compute url[:nPath] (or use bytes.HasPrefix(url, path), which is length-safe). One-line change, mirroring the already-correct URIs loop.\n\nAlso checked and sound: CVE-2026-40890 (smartypants smartLeftAngle OOB) is fixed; CVE-2024-44337 (list/paragraph infinite loop) is fixed (deep nesting capped at maxNesting=64); default XSS is by design (Safelink/SkipHTML not in CommonFlags).\n\n## Tooling\n\nAI assistance was used while investigating. The panic is executed-verified with negative controls (IsSafeURL on empty/./.. panics with a slice-bounds error while \"/\" returns true; ToHTML with html.Safelink on `[x]()` panics while valid and javascript: links do not), and I confirmed at HEAD that IsSafeURL computes url[:nPath] before the `nLink >= nPath` guard.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/gomarkdown/markdown"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "0.0.0-20260724235538-61af6e1e6971"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gomarkdown/markdown/security/advisories/GHSA-cv23-7vc5-jfh7"
}, {
"type" : "WEB",
"url" : "https://github.com/gomarkdown/markdown/commit/61af6e1e69710c5ca13cfbaaaa1bc11bc763a8a9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gomarkdown/markdown"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-125" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-16T15:41:39Z",
"nvd_published_at" : null
}
}