Skip to main content

Hugo CVE-2026-58402

| EUVDEUVD-2026-41904 MEDIUM
Cross-site Scripting (XSS) (CWE-79)
2026-07-06 GitHub_M
5.1
CVSS 4.0 · Vendor: GitHub_M
Share

Severity by source

Vendor (GitHub_M) PRIMARY
5.1 MEDIUM
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
vuln.today AI
5.4 MEDIUM

PR:L because Markdown write access is required; UI:R for victim page-load; S:C and C:L/I:L for browser-session XSS impact with no server-side effect.

3.1 AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
SUSE
MEDIUM
qualitative
Red Hat
5.4 MEDIUM
qualitative

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
P
Scope
X

Lifecycle Timeline

2
Patch available
Jul 06, 2026 - 21:16 EUVD
Analysis Generated
Jul 06, 2026 - 20:05 vuln.today

DescriptionCVE.org

Hugo is a static site generator. From 0.60.0 until 0.163.3, Hugo's default code-block renderer wrote the Markdown code-fence language or info-string into the code class="language-…" data-lang="…" wrapper without HTML escaping. A fence info-string containing a quote and a script payload breaks out of the attribute and injects a live script element. This issue is fixed in 0.163.3.

AnalysisAI

Stored XSS in Hugo's default code-block renderer allows an attacker with Markdown contribution rights to inject arbitrary JavaScript into generated static pages. Hugo versions 0.60.0 through 0.163.2 write the code-fence info-string (language identifier) directly into HTML attribute values without escaping, so a crafted info-string containing a quote character and script payload breaks out of the attribute context. No public exploit or KEV listing exists at time of analysis; the CVSS 4.0 score of 5.1 reflects the requirement for prior write access and victim interaction.

Technical ContextAI

Hugo (cpe:2.3:a:gohugoio:hugo:*:*:*:*:*:*:*:*) is a Go-based static site generator. Its default chroma code-block renderer generates HTML such as <code class="language-X" data-lang="X"> where X is the info-string immediately following the opening triple-backtick fence. From version 0.60.0 onward this string was interpolated into the attribute value without HTML entity encoding. CWE-79 (Improper Neutralization of Input During Web Page Generation / Cross-site Scripting) captures the root cause: a trust boundary is violated when Markdown authored by a less-trusted contributor is rendered into HTML without sanitizing attribute-context metacharacters. A payload such as `go" onload="alert(document.cookie) causes the double-quote to terminate the attribute value and the subsequent text to be parsed as a new event-handler attribute, effectively injecting a live script execution point into the static HTML output Hugo writes to disk.

RemediationAI

Upgrade Hugo to version 0.163.3, the vendor-released patch that introduces HTML escaping of code-fence info-strings before attribute interpolation (fix commit ce1a7e0bce3713af40496ded3c2c0ceeed49231d, pull request https://github.com/gohugoio/hugo/pull/15051). For sites that cannot upgrade immediately, the most effective compensating control is to restrict who can submit Markdown content - if all contributors are fully trusted, the attack surface disappears regardless of Hugo version. A secondary workaround is to override Hugo's default code-block render hook with a custom layout/shortcode that explicitly escapes the info-string using Hugo's htmlEscape function; this adds maintenance overhead but keeps the Hugo version frozen. Disabling syntax highlighting entirely (setting pygmentsCodeFences = false or removing chroma config) eliminates the vulnerable code path but at the cost of losing highlighted code blocks site-wide. No other known compensating control fully mitigates the issue without one of these trade-offs.

Vendor StatusVendor

SUSE

Severity: Moderate

Share

CVE-2026-58402 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy