REDHAT-BUG-2541895: Medium severity Hugo Hugo vulnerability

Published Sep 26, 2026
·
Updated

Hugo versions 0.75.0 through 0.165.x contain a stored cross-site scripting vulnerability: the syntax highlighter does not escape the lineAnchors option before passing it to Chroma, which writes the value verbatim into the id and href attributes of the generated line-number markup. A crafted lineAnchors value supplied as a Markdown code fence attribute (or passed to the highlight template function) results in unescaped HTML in the rendered page, allowing arbitrary JavaScript to execute in the browsers of visitors to the generated site. This affects sites that build and publish Markdown from untrusted contributors; Hugo's security model otherwise considers content trusted input. Fixed in 0.166.0, where the lineAnchors value is HTML-escaped before being passed to Chroma.

Affected Software

1 affected component
Hugo Hugo>=0.75.0<0.166.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.166.0

Event History

Sep 26, 2026
Data Sourced
via Red Hat·01:41 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Which sites are realistically exposed to exploitation?

Sites that build and publish Markdown supplied by untrusted contributors are exposed. Hugo otherwise treats content as trusted input, so sites where only trusted authors can modify Markdown have a different risk profile.

2

What must an attacker be able to control?

An attacker needs to supply a crafted lineAnchors value in a Markdown code fence attribute or through use of the highlight template function. The resulting page must then be published and viewed by a visitor for the injected JavaScript to execute.

3

How can I determine whether a site is affected?

Check the Hugo version used to build the site: versions from 0.75.0 through 0.165.x are affected, while 0.166.0 includes escaping for lineAnchors. Also review whether untrusted parties can contribute Markdown or otherwise influence code-fence attributes or highlight template parameters.

4

What is the remediation?

Upgrade Hugo to version 0.166.0, which HTML-escapes lineAnchors before passing it to Chroma. If upgrading is not immediately possible, do not build or publish untrusted Markdown that can set code-fence attributes or influence highlight template parameters.

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