GHSA-4whp-jx7j-xvrm: Hugo highlight wrapperClass option allows stored cross-site scripting
Published 2026-12-01 · Updated 2026-12-01
Summary
The Hugo highlight shortcode improperly escapes the wrapperClass option, allowing content authors to inject malicious scripts into generated pages. Administrators of multi-author Hugo sites should update to the patched version to prevent stored cross-site scripting (XSS) attacks.
Who is affected
This vulnerability affects sites using Hugo version 0.140.2 up to 0.169.9. It requires a content author with the ability to define highlight shortcode parameters to inject arbitrary HTML or JavaScript, which then executes in the browsers of visitors viewing the rendered content.
Exploitability
The vulnerability is rated as Medium severity. It requires user interaction and local access or authoring privileges, and is not currently listed in the CISA Known Exploited Vulnerabilities catalog.
Remediation
- Upgrade Hugo to version 0.170.0 or later.
- Review content files for untrusted use of the highlight shortcode or transform.Highlight template function.
How to check your project
- Check your project's go.mod or hugo version command output to see if the version is between 0.140.2 and 0.169.9.
- Search your project codebase for instances of the 'highlight' shortcode or 'transform.Highlight' functions that utilize the 'wrapperClass' option.
Automated analysis of the published advisory data, generated 2026-12-01. Not human-reviewed; verify against the official advisory. How this works.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | Upgrade |
|---|---|---|---|---|
| Go | github.com/gohugoio/hugo |
>= 0.140.2, < 0.170.0 | 0.170.0 | go get github.com/gohugoio/[email protected] |
CVSS 4.0 vector
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:N/VI:L/VA:N/SC:L/SI:L/SA:N
| Attack vector | Local |
|---|---|
| Attack complexity | Low |
| Attack requirements | None |
| Privileges required | None |
| User interaction | Active |
| Confidentiality (vulnerable system) | None |
| Integrity (vulnerable system) | Low |
| Availability (vulnerable system) | None |
| Confidentiality (subsequent systems) | Low |
| Integrity (subsequent systems) | Low |
| Availability (subsequent systems) | None |
Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.
FAQ
Does this affect standard Markdown code fences?
No, the vulnerability is specific to the 'highlight' shortcode and the 'transform.Highlight' template function, not Markdown code fences.
Does disabling the Goldmark 'unsafe' setting mitigate this?
No, the 'wrapperClass' value does not pass through the Markdown HTML renderer, meaning the Goldmark 'unsafe' setting provides no protection against this specific flaw.
Is this vulnerability being actively exploited in the wild?
There is no documentation or CISA KEV data to suggest active exploitation at this time.
Original advisory description
References
- WEB https://github.com/gohugoio/hugo/security/advisories/GHSA-4whp-jx7j-xvrm
- WEB https://github.com/gohugoio/hugo/pull/15564
- WEB https://github.com/gohugoio/hugo/commit/bdde5aa5155c6c349a743e71dc846bef754b6773
- PACKAGE https://github.com/gohugoio/hugo
- WEB https://github.com/gohugoio/hugo/releases/tag/v0.170.0
Source records: GHSA-4whp-jx7j-xvrm (OSV.dev).