CVE-2026-58402
JSON

5.1medium

Hugo default code block renderer XSS via unescaped code-fence language

Severity
5.1medium CVSS:4.0 by GitHub_M
Exploit likelihood
0.30% (higher than 15% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-q76j-gcg9-vxc6GO-2026-5569

Description

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.

Affected

Product or packageVersionsReported by
gohugoio hugo>= 0.60.0, < 0.163.3CVE List
github.com/gohugoio/hugo (Go)from 0.60.0 before 0.163.3GitHub Advisory Database, Go Vulnerability Database
gohugo hugofrom 0.60.0 before 0.163.3NVD

All scores

GitHub_M5.1medium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
GitHubmedium CVSS:4.0CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
NVD5.4medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

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.

GitHub Advisory Database

Hugo's default code-block renderer wrote the Markdown code-fence language / 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 is not an issue if you fully trust every file under /content and every content adapter you load.

Go Vulnerability Database

Hugo: XSS via unescaped code-fence language in default code block renderer in github.com/gohugoio/hugo

NVD (es)

Hugo es un generador de sitios estáticos. Desde la versión 0.60.0 hasta la 0.163.3, el renderizador de bloques de código predeterminado de Hugo escribía el lenguaje de la valla de código Markdown o la cadena de información en el contenedor code class=“language-...” data-lang=“...” sin escape HTML. Una cadena de información de valla que contiene una comilla y una carga útil de script escapa del atributo e inyecta un elemento de script activo. Este problema se solucionó en la versión 0.163.3.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-58402 changed 2026-07-06CVE Terms of Use
GitHub Advisory DatabaseGHSA-q76j-gcg9-vxc6 changed 2026-07-24CC-BY-4.0
Go Vulnerability DatabaseGO-2026-5569 changed 2026-07-24CC-BY-4.0
NVDCVE-2026-58402 changed 2026-10-25Public domain