GHSA-4WHP-JX7J-XVRM
XSS via unescaped `wrapperClass` option in the `highlight` shortcode
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-4WHP-JX7J-XVRM divulgada | |
| Remediación | Parche v0.170.0 | github.com/gohugoio/hugo · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
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.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/gohugoio/hugo |
Corregida | v0.170.0 | 0 d | v0.170.0 no afectada |
v0.170.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/gohugoio/hugo/security/advisories/GHSA-4whp-jx7j-xvrmLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
