CVE-2026-140394: Hugo 0.140.2 before 0.170.0 Stored XSS via highlight shortcode wrapperClass

Published Dec 1, 2026
·
Updated

Hugo after 0.140.2 and before 0.170.0 contains a stored cross-site scripting vulnerability in the highlight shortcode and transform.Highlight template function, which write the wrapperClass option unescaped into the wrapping div's class attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.

Affected Software

1 affected component
Hugo Hugo>0.140.2<0.170.0

Event History

Dec 1, 2026
CVE Published
via MITRE·02:29 PM
Data Sourced
via MITRE·02:29 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who can exploit this issue?

An attacker needs the ability to author or modify Hugo content that uses the highlight shortcode or the transform.Highlight template function and can set its wrapperClass option. The resulting JavaScript executes in the browsers of visitors viewing the generated affected content.

2

Which Hugo versions are affected?

The affected range is after Hugo 0.140.2 and before 0.170.0. Hugo 0.170.0 is outside the stated affected range.

3

What can be done if upgrading is not immediately possible?

Restrict who can create or modify Hugo content and templates, and do not allow untrusted authors to set wrapperClass values. Review existing uses of the highlight shortcode and transform.Highlight for wrapperClass input that may contain attribute-breaking characters or markup.

4

How can I determine whether a site may already contain an exploit payload?

Search content and templates for highlight shortcode or transform.Highlight usage with the wrapperClass option. A suspicious value may attempt to close the HTML class attribute and add markup such as a script element.

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