CVE-2026-100691: Hugo before 0.166.0 Stored XSS via lineAnchors code block option

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.165.x

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
CVE Published
via MITRE·01:23 PM
Data Sourced
via MITRE·01:23 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:16 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which sites are realistically exposed?

Sites using Hugo 0.75.0 through 0.165.x are exposed when they build and publish Markdown supplied by untrusted contributors. Hugo otherwise treats content as trusted input, so sites where only trusted users can modify content have a substantially narrower exposure scenario.

2

What does an attacker need to exploit this issue?

An attacker needs the ability to provide Markdown that is rendered and published by the site, using a crafted lineAnchors value in a code fence attribute. The same vulnerable value can also be supplied through the highlight template function.

3

What is the impact after malicious content is published?

The crafted value is written unescaped into generated id and href attributes in line-number markup. This permits arbitrary JavaScript execution in the browsers of visitors to the affected generated page.

4

What can be done if upgrading is not immediately possible?

Do not accept or publish untrusted Markdown containing code fence attributes that can set lineAnchors, and prevent untrusted input from reaching uses of the highlight template function. Review contributor-supplied content before publication, particularly code blocks with highlighting options.

5

How can I determine whether content may already be affected?

Review published or pending Markdown from untrusted contributors for code fence attributes that set lineAnchors, and review template usage of the highlight function where its options may be influenced by untrusted input. Generated pages with line-number markup should also be checked for unexpected or unescaped content in id and href 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