Home › Vulnerabilities › gohugoio
Hugo Path Traversal and Stored XSS Flaws Fixed in Releases Before 0.170.0
Two Hugo vulnerabilities published by NVD on 2026-12-01 affect versions before 0.170.0: a high-severity path traversal (CVE-2026-140395, CVSS 8.7) that can expose build host files, and a medium-severity stored cross-site scripting flaw (CVE-2026-140394, CVSS 5.1) in the highlight shortcode and transform.Highlight template function.
What to look into
- 2 vulnerabilities in gohugoio hugo: 1 high, 1 medium (CVSS up to 8.7).
- None of them is known to be exploited yet.
- Start with CVE-2026-140395 (8.7 high): Hugo from 0.56.0 before 0.170.0 contains a path traversal vulnerability that allows malicious themes or modules to read arbitrary build host files by supplying '..' segments in vendor/modules.txt imp… An attacker without an account can exploit this over the network, without any user action.
- 1 of 2 can be attacked over the network without logging in, 1 of them without anyone clicking anything.
- Kinds of flaws: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'); Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Key points
- CVE-2026-140395 (CVSS 8.7, HIGH) lets malicious themes or modules read arbitrary build host files via '..' in vendor/modules.txt import paths.
- CVE-2026-140394 (CVSS 5.1, MEDIUM) is a stored XSS in the highlight shortcode and transform.Highlight wrapperClass option.
- Both flaws affect Hugo versions before 0.170.0.
- The records do not report active exploitation.
Overview
NVD published two vulnerabilities in the Hugo static site generator (gohugoio hugo) on 2026-12-01. Both are described as fixed in version 0.170.0. The batch contains one path traversal flaw and one cross-site scripting flaw, and the records place the most serious risk in the first.
Path traversal (CVE-2026-140395)
The more severe issue is rated HIGH with a CVSS score of 8.7. According to the record, Hugo from 0.56.0 before 0.170.0 does not properly handle '..' segments in import paths listed in vendor/modules.txt. A malicious theme or module could use this to make Hugo treat an arbitrary directory as a module root. The record states that readFile calls or static mounts could then pull secrets, credentials, and system files from the build host into the generated site, where they could be published.
Stored cross-site scripting (CVE-2026-140394)
The second issue, CVE-2026-140394, is rated MEDIUM with a CVSS score of 5.1. It affects Hugo versions after 0.140.2 and before 0.170.0. The highlight shortcode and the transform.Highlight template function write the wrapperClass option into a div's class attribute without escaping it. A content author who supplies a crafted wrapperClass value could close the attribute and add a script element, which would run in visitors' browsers under the site's origin.
Who is affected
The records do not describe any exploitation in the wild. The path traversal issue depends on malicious themes or modules, so the exposure is greatest for sites that use third-party themes or modules. The XSS issue depends on content authors who can set the wrapperClass option, so it matters most for sites with multiple or untrusted contributors.
Remediation
Both records give the same fixed version: 0.170.0. The records do not provide workarounds, configuration changes, or detection guidance.
What to do
- Upgrade Hugo to version 0.170.0 or later.
- Review third-party themes and modules used by the site, since the path traversal flaw depends on them.
The 2 vulnerabilities
- CVE-2026-140395 8.7 Hugo from 0.56.0 before 0.170.0 contains a path traversal vulnerability that allows malicious themes or modules to read arbitrary build host files by supplying '..' segments in vendor/modules.txt import paths. Attackers can make Hugo treat…
- CVE-2026-140394 5.1 Hugo after 0.140.2 and before 0.170.0 contains a stored cross-site scripting vulnerability in the highlight shortcode and transform.Highlight template function, which write the wrapperClass option unescaped into the wrapping div's class at…
Frequently asked questions
How many gohugoio hugo vulnerabilities were published on December 1, 2026?
2 vulnerabilities: 1 high, 1 medium, with CVSS scores up to 8.7.
Are any of them being exploited?
None of them is in CISA's Known Exploited Vulnerabilities catalog yet.
Which one should be fixed first?
CVE-2026-140395 (CVSS 8.7): Hugo from 0.56.0 before 0.170.0 contains a path traversal vulnerability that allows malicious themes or modules to read arbitrary build host files by supplying '..' segments in vendor/modules.txt imp…