{"id":"GHSA-4whp-jx7j-xvrm","aliases":[],"url":"https://o3.security/vulnerability/GHSA-4whp-jx7j-xvrm","summary":"Hugo highlight wrapperClass option allows stored cross-site scripting","details":"### Summary\n\nThe `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.\n\n### Details\n\n`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.\n\nFixed by HTML-escaping the value.\n\n### Proof of concept\n\nA 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.\n\n### Impact\n\nStored XSS for sites that render content from less-trusted authors. The `highlight` shortcode is built in and enabled by default.","published":"2026-12-01T02:24:46Z","modified":"2026-12-01T02:45:04.344926753Z","cvss":null,"epss":null,"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"Go","name":"github.com/gohugoio/hugo","fixedVersion":"0.170.0"}],"fix":{"url":"https://github.com/gohugoio/hugo/pull/15564","label":"gohugoio/hugo#15564"},"references":[{"type":"WEB","url":"https://github.com/gohugoio/hugo/security/advisories/GHSA-4whp-jx7j-xvrm"},{"type":"WEB","url":"https://github.com/gohugoio/hugo/pull/15564"},{"type":"WEB","url":"https://github.com/gohugoio/hugo/commit/bdde5aa5155c6c349a743e71dc846bef754b6773"},{"type":"PACKAGE","url":"https://github.com/gohugoio/hugo"},{"type":"WEB","url":"https://github.com/gohugoio/hugo/releases/tag/v0.170.0"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-12-01T02:45:04.344926753Z"}}