Description
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.
Affected products
| Vendor | Product | Affected | Fixed |
|---|---|---|---|
| gohugoio | hugo | 0.93.0 – ≤ 0.165.0 | — |
Fixed in Linux distributions
Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.
Debian
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian 14 | hugo | 0.166.0-1 | — |
| Debian 13 | hugo | No fix yet | — |
| Debian 12 | hugo | No fix yet | — |
Ubuntu
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 26.10 | hugo | No fix yet | — |
| Ubuntu 26.04 LTS | hugo | No fix yet | — |
| Ubuntu 22.04 LTS | hugo | No fix yet | — |
| Ubuntu 20.04 LTS | hugo | No fix yet | — |
| Ubuntu 18.04 LTS | hugo | No fix yet | — |
Show 2 more (older releases, extended support, other products)Fewer releases
| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Ubuntu 16.04 LTS | hugo | No fix yet | — |
| Ubuntu Pro 24.04 LTS | hugo | No fix yet | — |
Red Hat
Security tracker ↗| Release | Package | Fixed in | Advisory |
|---|---|---|---|
| Red Hat Hardened Images 1 | hugo | 0.166.0-0.1.hum1 | RHSA-2026:66266 |
Advisories 1
- RHSA-2026:66266 Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update Red Hat Security Advisories (RHSA) · Oct 20, 2026
References
- https://github.com/gohugoio/hugo product
- https://github.com/gohugoio/hugo/blob/v0.165.0/markup/internal/attributes/attributes.go technical-description
- https://github.com/gohugoio/hugo/blob/v0.165.0/markup/goldmark/codeblocks/render.go technical-description
- https://github.com/gohugoio/hugo/blob/v0.165.0/markup/highlight/highlight.go 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