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

Source: https://junglewise.ai/threats/cve-2026-58402-hugo-xss-in-default-code-block-renderer  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-06. Updated: 2026-07-06  
License: CC BY 4.0 with a link back

CVE-2026-58402 · Severity: medium · CVSS 4 · Published 2026-07-06

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.

Technologies: [github.com/gohugoio/hugo (Go)](https://junglewise.ai/threats/technologies/github-com-gohugoio-hugo), [Hugo](https://junglewise.ai/threats/technologies/hugo). Vendors: [Go](https://junglewise.ai/threats/vendors/go), [Hugo](https://junglewise.ai/threats/vendors/hugo).

## Quick answers

**Is CVE-2026-58402 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-58402 being exploited in the wild.

**How severe is CVE-2026-58402?** Medium severity, with a CVSS score of 4, published 6 July 2026.

**Which products and versions are affected?** github.com/gohugoio/hugo (Go) SEMVER:introduced=0.60.0,fixed=0.163.3; Hugo >= 0.60.0, < 0.163.3.

**Is there a fix for CVE-2026-58402?** Yes. github.com/gohugoio/hugo (Go): upgrade to 0.163.3 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-58402 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-58402?** Check whether you run github.com/gohugoio/hugo (Go) or Hugo at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- github.com/gohugoio/hugo (Go): upgrade to 0.163.3 or later

  ```sh
  go get github.com/gohugoio/hugo@v0.163.3
  ```


## 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

## Identifiers

- CVE-2026-58402
- GHSA-q76j-gcg9-vxc6
- GO-2026-5569

## 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

- [https://github.com/gohugoio/hugo/commit/ce1a7e0bce3713af40496ded3c2c0ceeed49231d](https://github.com/gohugoio/hugo/commit/ce1a7e0bce3713af40496ded3c2c0ceeed49231d)
- [https://github.com/gohugoio/hugo/pull/15051](https://github.com/gohugoio/hugo/pull/15051)
- [https://github.com/gohugoio/hugo/releases/tag/v0.163.3](https://github.com/gohugoio/hugo/releases/tag/v0.163.3)
- [https://github.com/gohugoio/hugo/security/advisories/GHSA-q76j-gcg9-vxc6](https://github.com/gohugoio/hugo/security/advisories/GHSA-q76j-gcg9-vxc6)

## Related threats

- [Hugo path traversal in js.Build and css.Build via ESBuild](https://junglewise.ai/threats/cve-2026-109595-hugo-from-v0-84-0-before-v0-167-0-contains-a-path-traversal)
- [Hugo path traversal in css.Sass import fallback](https://junglewise.ai/threats/cve-2026-109574-hugo-before-v0-167-0-contains-a-path-traversal-vulnerability-in)
- [Hugo stored cross-site scripting in lineAnchors](https://junglewise.ai/threats/cve-2026-100691-hugo-versions-0-75-0-through-0-165-x-contain-a-stored-cross-site)
- [Hugo insufficient permission restriction via TailwindCSS](https://junglewise.ai/threats/cve-2026-89259-hugo-insufficient-permission-restriction-via-tailwindcss)
- [Hugo fenced code block attribute injection](https://junglewise.ai/threats/cve-2026-10618-hugo-fenced-code-block-attribute-injection)
