Vulnerabilities in pkg:golang/github.com/gohugoio/hugo

PACKAGE
Advisory Summary

GHSA-4whp-jx7j-xvrm is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Github.com/gohugoio/hugo libraries in the Go ecosystem. The issue involves hugo highlight wrapperclass option allows stored cross-site scripting. Remediation is available by upgrading affected packages to version 0.170.0.

14 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gohugoio/hugo

14 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gohugoio/hugo. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-4whp-jx7j-xvrm - MODERATE Hugo highlight wrapperClass option allows stored cross-site scripting
GHSA-r48v-r4vw-h9v8 - MODERATE Hugo: Build-host file disclosure through path traversal in vendored module metadata
GHSA-r73q-gwx2-fpxm - MODERATE Hugo theme-defined module replacements bypass mount restrictions and widen the Node.js read sandbox
GHSA-r46f-3rpw-hxrv - HIGH Hugo: security.http.urls deny rules bypassed by alternate IPv4 encodings (SSRF)
GHSA-c3wq-j5vh-68rc - MODERATE Hugo: Symlink confinement bypass in os.ReadFile
GHSA-q76j-gcg9-vxc6 - MODERATE Hugo: XSS via unescaped code-fence language in default code block renderer
GHSA-fw87-fv5r-9fpw CVE-2026-50135 MODERATE Hugo: Symlink confinement bypass in resources.Get
GHSA-vxgm-5rmg-5w8g CVE-2026-50134 MODERATE Hugo: security.http.urls allow-list bypass via HTTP redirects
GHSA-c54g-xjwj-8g82 CVE-2026-50133 MODERATE Hugo: XSS via text/html content files
GHSA-x597-9fr4-5857 CVE-2026-44301 MODERATE Hugo's Node tool execution allows file system access outside the project directory
GHSA-mcv8-8m8x-48pg CVE-2026-35166 MODERATE Hugo: Certain markdown links are not properly escaped
GHSA-c2xf-9v2r-r2rx CVE-2024-55601 MODERATE Hugo does not escape some attributes in internal templates
GHSA-ppf8-hhpp-f5hj CVE-2024-32875 MODERATE Hugo Markdown titles do not escaped in internal render hooks
GHSA-8j34-9876-pvfq CVE-2020-26284 HIGH Hugo can execute a binary from the current directory on Windows

GHSA-4whp-jx7j-xvrm at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-4whp-jx7j-xvrm
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Github.com/gohugoio/hugo
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-4whp-jx7j-xvrm

To remediate this vulnerability, upgrade all affected Github.com/gohugoio/hugo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gohugoio/hugo fixed: 0.170.0
Upgrade github.com/gohugoio/hugo to 0.170.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gohugoio/hugo

How to Check if You Are Affected

To determine whether your application is affected by GHSA-4whp-jx7j-xvrm, inspect your project dependencies for Github.com/gohugoio/hugo:

inspect dependencies for github.com/gohugoio/hugo

Analyze the terminal output to locate any version of Github.com/gohugoio/hugo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.170.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Github.com/gohugoio/hugo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### 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.

GHSA-4whp-jx7j-xvrm Affected Github.com/gohugoio/hugo Versions

1 component(s)
Fixed Versions:
0.170.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gohugoio/hugo
Go
≥ 0.140.2
< 0.170.0
0.170.0

References

Frequently Asked Questions

What is GHSA-4whp-jx7j-xvrm?
GHSA-4whp-jx7j-xvrm is a security vulnerability in Github.com/gohugoio/hugo involving Hugo highlight wrapperClass option allows stored cross-site scripting under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Github.com/gohugoio/hugo versions are affected?
Affected versions include releases prior to 0.170.0 across affected packages: github.com/gohugoio/hugo.
What version fixes GHSA-4whp-jx7j-xvrm?
Upgrading to 0.170.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gohugoio/hugo affected?
Yes, github.com/gohugoio/hugo is affected in releases prior to 0.170.0. Upgrade your dependency to 0.170.0 or later.
What CWE is associated with GHSA-4whp-jx7j-xvrm?
GHSA-4whp-jx7j-xvrm is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check Go dependencies for GHSA-4whp-jx7j-xvrm?
Run the dependency tree command: 'inspect dependencies for github.com/gohugoio/hugo'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-4whp-jx7j-xvrm",
  "modified" : "2026-12-01T02:24:46Z",
  "published" : "2026-12-01T02:24:46Z",
  "aliases" : [ ],
  "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.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gohugoio/hugo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.140.2"
      }, {
        "fixed" : "0.170.0"
      } ]
    } ]
  } ],
  "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"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T02:24:46Z",
    "nvd_published_at" : null
  }
}