NIST deprecates RSA-2048 from 2030. Find every one of them before attackers do.
🐹 Go
Not in CISA KEV

Hugo highlight wrapperClass option allows stored cross-site scriptingGHSA-4whp-jx7j-xvrm

Fix: gohugoio/hugo#15564

GHSA-4whp-jx7j-xvrm is a security vulnerability in github.com/gohugoio/hugo. A fix is available for github.com/gohugoio/hugo — see the affected versions and patch details below.

Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Dec 1, 2026 · OSV.dev, FIRST.org (EPSS)

Real-World Exposure

1 pkg affected
🐹github.com/gohugoio/hugo

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.

Description

Summary

The wrapperClass option of the built-in highlight shortcode (and the transform.Highlight template function) was written unescaped into the wrapping <div class="...">, allowing a content author to inject arbitrary HTML/JavaScript into the rendered page.

Details

markup/highlight/highlight.go (writeDivStart) wrote wrapperClass directly between class=" and ", while all other attribute values were HTML-escaped. Because the shortcode's options string is decoded into the highlight config, any content author can set wrapperClass. The Goldmark unsafe setting does not apply, as the value never passes through the Markdown HTML renderer. Markdown code fences are not affected.

Fixed by HTML-escaping the value.

Proof of concept

A content author on a multi-author site adds a highlight shortcode to a page with a wrapperClass option value that closes the class attribute and appends a <script> element. When the site is built, the script ends up in the page body and runs in visitors' browsers under the site's origin.

Impact

Stored XSS for sites that render content from less-trusted authors. The highlight shortcode is built in and enabled by default.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐹Gogithub.com/gohugoio/hugo≥ 0.140.2&&< 0.170.00.170.0go get github.com/gohugoio/hugo@v0.170.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/gohugoio/hugo, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update github.com/gohugoio/hugo to 0.170.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-4whp-jx7j-xvrm is resolved across your whole dependency graph.

  3. Workarounds

    Escape or sanitise the affected output on the server side rather than relying on client-side filtering, and add a Content-Security-Policy that blocks inline script execution so injected markup cannot run even if it reaches the page.

Frequently Asked Questions

### Summary The `wrapperClass` option of the built-in `highlight` shortcode (and the `transform.Highlight` template function) was written unescaped into the wrapping `<div class="...">`, allowing a content author to inject arbitrary HTML/JavaScript into the rendered page. ### Details `markup/highlight/highlight.go` (`writeDivStart`) wrote `wrapperClass` directly between `class="` and `"`, while all other attribute values were HTML-escaped. Because the shortcode's options string is decoded into the highlight config, any content author can set `wrapperClass`. The Goldmark `unsafe` setting doe
O3 Security · Impact-Aware SCA

Is GHSA-4whp-jx7j-xvrm in your dependencies?

Find it across Go, including transitive dependencies.

Hugo highlight wrapperClass option allows stored…