Junglewise Threat Intelligence

CVE-2026-58402: Hugo XSS in default code-block renderer

CVE-2026-58402 · Severity: info · CVSS 5.1 · Published 2026-07-06

Technologies: Gohugoio Hugo. Vendors: Hugo.

Executive brief

Hugo, a popular tool for building websites, contains a security flaw in how it handles code blocks in website content. If a website includes content from untrusted sources, an attacker could inject malicious scripts that run in the browsers of site visitors. This could lead to unauthorized actions or data theft on the affected website.

Technical details

A Cross-Site Scripting (XSS) vulnerability exists in Hugo's default code-block renderer (Goldmark) between versions 0.60.0 and 0.163.3. The renderer writes the Markdown code-fence language or info-string directly into the 'class' and 'data-lang' attributes of the resulting HTML <code> wrapper without proper HTML escaping. By including a quote and a script payload in the fence info-string, an attacker can break out of the attribute and inject a live script element. This vulnerability is particularly relevant for sites that process untrusted content or use external content adapters. The issue is fixed in version 0.163.3 by ensuring the language string is properly escaped during rendering.

Affected products

  • gohugoio Hugo >= 0.60.0, < 0.163.3

Timeline

  • 2026-06-18: patched: Fixed in version 0.163.3 and advisory published on GitHub
  • 2026-07-06: advisory: NVD published the CVE record

References

Related threats