PT-2026-80796 · Hugo · Hugo
CVSS v3.1
5.4
Medium
| Vector | AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N |
Name of the Vulnerable Software and Affected Versions
Hugo versions 0.93.0 through 0.165.0
Description
The default fenced-code-block renderer fails to escape attribute values derived from the code-fence info string when writing them to the rendered HTML. This occurs because the
New function in markup/internal/attributes/attributes.go converts attribute values from byte slices to strings, bypassing the escaping process. Subsequently, the RenderAttributes() function only escapes values that remain as byte slices, meaning string values are written verbatim. An attacker can use a quote within an attribute value to terminate the attribute and inject additional attributes, such as event handlers, into the wrapper element, leading to stored Cross-Site Scripting (XSS). This issue is present in the default configuration when code fences are enabled, regardless of the goldmark unsafe setting or custom render hooks. While attribute names starting with on are filtered during parsing, injection is still possible via the attribute value.Recommendations
Update Hugo to a version later than 0.165.0.
Exploit
Fix
XSS
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Hugo