CVE-2026-5160 — html
Fix: yuin/goldmark@cb46bbcCVE-2026-5160 is a Cross-site Scripting (XSS) vulnerability in github.com/yuin/goldmark/renderer/html. A fix is available for github.com/yuin/goldmark/renderer/html — see the affected versions and patch details below.
goldmark vulnerable to Cross-site Scripting (XSS)
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
github.com/yuin/goldmark/renderer/htmlReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Versions of the package github.com/yuin/goldmark/renderer/html before 1.7.17 are vulnerable to Cross-site Scripting (XSS) due to improper ordering of URL validation and normalization. The renderer validates link destinations using a prefix-based check (IsDangerousURL) before resolving HTML entities. This allows an attacker to bypass protocol filtering by encoding dangerous schemes using HTML5 named character references. For example, a payload such as javascript:alert(1) is not recognized as dangerous during validation, leading to arbitrary script execution in the context of applications that render the URL.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/yuin/goldmark/renderer/html | all versions | 1.7.17go get github.com/yuin/goldmark/renderer/html@v1.7.17 |
Affected Products
goldmarkyuinDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/yuin/goldmark/renderer/html, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/yuin/goldmark/renderer/html to 1.7.17 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-5160 is resolved across your whole dependency graph.
Workarounds
Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
This vulnerability is rated as Moderate as user interaction is required by accessing the maliciously crafted content in order to an attacker perform the exploit. A Cross-site Scripting (XSS) flaw exists in `github.com/yuin/goldmark/renderer/html` due to incorrect ordering of URL validation and HTML entity resolution.…
To mitigate this vulnerability, avoid rendering untrusted content with applications utilizing `github.com/yuin/goldmark/renderer/html`. Ensure that all input processed by the affected component is thoroughly sanitized to prevent the injection of malicious HTML entities or dangerous URL schemes.Source: Red Hat security advisory for CVE-2026-5160 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-5160 in your dependencies?
Find it across Go, including transitive dependencies.