CVE-2026-10618: Hugo 0.93.0 through 0.165.0 Stored Cross-Site Scripting via Unescaped Code-Fence Attribute Values

Published Aug 24, 2026
·
Updated

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 Software

1 affected component
Hugo Hugo>=0.93.0<=0.165.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Hugo to a version that resolves this vulnerability.

    Fixed in 0.93.0 through 0.165.0

Event History

Aug 24, 2026
CVE Published
via MITRE·10:29 AM
Data Sourced
via MITRE·10:29 AM
DescriptionSeverityWeakness
Data Sourced
via NVD·11:16 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is exposed to this issue?

Sites built with affected Hugo versions are exposed if untrusted users can influence fenced code-block info strings or their attribute values. Any visitor who loads a page containing a maliciously crafted code fence can have script executed in their browser.

2

Does exploitation require a non-default Hugo or Goldmark configuration?

No. The vulnerable rendering path is reachable with Hugo's default configuration, code fences enabled, and no Goldmark unsafe setting or custom render hook.

3

What does an attacker need to control?

The attacker needs to supply a code-fence info string containing an attribute value with a quote. The quote can terminate the intended HTML attribute and add another attribute, such as an event handler, to the rendered wrapper element.

4

Are event-handler attribute names blocked?

Attribute names beginning with "on" are filtered during parsing. However, that filtering does not prevent exploitation because the injection is performed through an unescaped attribute value rather than a malicious attribute name.

5

How can I determine whether a page is affected?

Review rendered pages containing fenced code blocks whose info strings include attributes, especially content originating from untrusted contributors. A page is affected if a quote in an attribute value is emitted verbatim into the code-block wrapper's HTML attributes.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203