XSS in Gohugo Hugo
CVE-2026-10618
- CVSS v3
- 5.4 Medium
- Public exploits
- None known
- EPSS
- 0.003 · 23.3th percentile
- Published
- 2026-08-24
Hugo's default fenced-code-block renderer writes attribute values taken from the code-fence info string into the rendered HTML without escaping them. New in markup/internal/attributes/attributes.go converts every attribute value from a byte slice to a string as it is stored, deliberately dropping the escaping that used to happen there, and RenderAttributes in the same file escapes only values that are still byte slices, so its escaping branch is never reached and every value is written verbatim. The function's documentation states that it performs HTML escaping of string attributes, which it does not. A quote inside an attribute value in the info string therefore terminates the attribute and allows a further attribute, including an event handler, to be placed on the wrapper element, and the script runs for every visitor who loads the page. This path is reached under the default configuration, with code fences enabled and without goldmark's unsafe setting or any custom render hook. Attribute names beginning with on are filtered when the attributes are parsed, so injection is achieved through the value rather than the name.
Vulnerability class: XSS (Cross-Site Scripting)
Published · last modified .
CVSS v3 metric
CVSS v3 base score 5.4 (Medium). Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N.
- Attack Vector
- Network
AV:N - Attack Complexity
- Low
AC:L - Privileges Required
- Low
PR:L - User Interaction
- Required
UI:R - Scope
- Changed
S:C - Confidentiality
- Low
C:L - Integrity
- Low
I:L - Availability
- None
A:N
EPSS exploit prediction
EPSS 0.003, 23.3th percentile (last changed ); unchanged over 30 days. About EPSS.
Affected products
Weakness classification (CWE)
References
- github.com/gohugoio/hugo (Product, product)
- github.com/gohugoio/hugo/blob/v0.165.0/markup/internal/attributes/attributes.go (Product, technical-description)
- github.com/gohugoio/hugo/blob/v0.165.0/markup/goldmark/codeblocks/render.go (Product, technical-description)
- github.com/gohugoio/hugo/blob/v0.165.0/markup/highlight/highlight.go (Product, technical-description)
- VulnCheck Advisory: Hugo 0.93.0 through 0.165.0 Stored Cross-Site Scripting via Unescaped Code-Fence Attribute Values (Third Party Advisory, third-party-advisory)