CVE-2026-140394
Hugo 0. 140. 2 before 0. 170. 0 Stored XSS via highlight shortcode wrapperClass
- Severity
- 5.1MediumNetwork attack, low privileges, needs user interactionCVSS 4.0, CVE ListGitHub Advisories gives 4.6
- Exploitation
- Proof of conceptCISA reports one, no source links it
- Exploit chance
- 0.41% in 30 daysPercentile37thEPSS, scored
- Listed fix
0.170.0for github.com/ gohugoio/ hugo From GitHub Advisories and OSV8 other affected packages
Overview
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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
CVSS 4.0 vector
Exploitability
- Attack vector
- Network
- Complexity
- Low
- Attack requirements
- None
- Privileges needed
- Low
- User interaction
- Passive
Impact on the vulnerable system
- Confidentiality
- None
- Integrity
- None
- Availability
- None
Impact on subsequent systems
- Confidentiality
- Low
- Integrity
- Low
- Availability
- None
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:NExploit chance over time
Affected
Packages 9
| Package | Affected | Fixed |
|---|---|---|
github.com/gohugoio/hugoGo | 0.140.2 up to 0.170.0 | 0.170.0 |
hugoDebian:14 | All versions, plus listed versions 0.131.0-10.131.0-20.150.0-10.150.1-10.151.0-1 Show 45 more versionsShow less0.151.1-10.151.2-10.152.1-10.152.2-10.153.0-10.153.1-10.153.1-20.153.1-30.153.2-10.154.1-10.154.2-10.154.2-20.154.3-10.154.5-10.155.1-10.155.2-10.155.3-10.157.0-10.157.0-20.157.0-30.158.0-10.158.0-20.158.0-30.159.0-10.159.1-10.159.2-10.160.0-10.160.0-20.160.1-10.161.0-10.161.1-10.162.1-10.162.1-20.162.1-30.162.1-40.162.1-50.162.1-60.162.1-70.165.0-10.165.0-20.165.0-30.166.0-10.166.0-20.167.0-10.167.0-2 | None listed |
hugoUbuntu:16.04:LTS | All versions, plus listed versions 0.15+git20160109.147.dd1d655-10.15+git20160109.147.dd1d655-20.15+git20160128.179.5def6d9-10.15+git20160206.203.ed23711-1 | None listed |
hugoUbuntu:18.04:LTS | All versions, plus listed versions 0.25.1-20.26-10.35-10.37.1-10.38-10.39-10.40-10.40.1-1 | None listed |
hugoUbuntu:20.04:LTS | All versions, plus listed versions 0.57.2-10.58.3-10.59.1-1.10.68.3-1 | None listed |
hugoUbuntu:22.04:LTS | All versions, plus listed versions 0.80.0-60.89.4-20.90.0-10.90.1-10.91.0-1 Show 5 more versionsShow less0.91.2-10.92.0-10.92.1-1build10.92.2-10.92.2-1ubuntu0.1 | None listed |
hugoUbuntu:Pro:24.04:LTS | All versions, plus listed versions 0.113.0-30.119.0-20.120.3-10.120.4-10.121.2-1 Show 8 more versionsShow less0.122.0-10.123.7-1build10.123.7-1ubuntu0.10.123.7-1ubuntu0.20.123.7-1ubuntu0.2+esm10.123.7-1ubuntu0.30.123.7-1ubuntu0.3+esm10.123.7-1ubuntu0.3+esm2 | None listed |
hugoUbuntu:26.10 | All versions, plus listed versions 0.154.5-10.162.1-50.162.1-7 | None listed |
hugoUbuntu:26.04:LTS | All versions, plus listed versions 0.131.0-10.152.2-10.153.1-30.153.2-10.154.2-20.154.3-10.154.5-1 | None listed |
The JSON record also has 12 more versions.
Only in multi-CVE advisories 1
Each of these advisories covers several CVEs at once, so it doesn’t establish that this one affects the package.
| Package | Affected | Fixed |
|---|---|---|
hugoRed Hat:hummingbird:1 | before 0:0.170.1-0.1.hum1 From an advisory covering 2 CVEs | 0:0.170.1-0.1.hum1 |
Products 1
Sources
CVE List Score usedCVSS 4.05.1
Hugo 0.140.2 before 0.170.0 Stored XSS via highlight shortcode wrapperClass
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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
CVE-2026-140394- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-12-01
EUVDEUVD-2026-140249CVSS 4.05.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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
EUVD-2026-140249- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N - Updated
- 2026-12-01
GitHub AdvisoriesGHSA-332r-53xh-x52jCVSS 4.05.1
Hugo after 0.140.2 and before 0.170.0 contains a stored cross-site scripting vulnerability in the...
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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
GHSA-332r-53xh-x52j- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-12-01
GitHub AdvisoriesGHSA-4whp-jx7j-xvrmCVSS 4.04.6
Hugo highlight wrapperClass option allows stored cross-site scripting
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.
- Record
GHSA-4whp-jx7j-xvrm- CVSS 4.0
- 4.6 Medium
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 - Weakness
- CWE-79
- Updated
- 2026-12-01
NVDCVSS 4.05.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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
CVE-2026-140394- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 5.4 Medium
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N - Weakness
- CWE-79
- Updated
- 2026-12-01
OSVCVSS 4.05.1
Hugo 0.140.2 before 0.170.0 Stored XSS via highlight shortcode wrapperClass
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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
CVE-2026-140394- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N - Weakness
- CWE-79
- Updated
- 2026-12-01
Show 4 more recordsShow less
OSVDEBIAN-CVE-2026-140394CVSS 4.05.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 attribute. Content authors can supply a wrapperClass value that closes the attribute and appends a script element, executing JavaScript in visitors' browsers under the site's origin.
- Record
DEBIAN-CVE-2026-140394- CVSS 4.0
- 5.1 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - Updated
- 2026-12-02
OSVGHSA-4whp-jx7j-xvrmCVSS 4.04.6
Hugo highlight wrapperClass option allows stored cross-site scripting
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.
- Record
GHSA-4whp-jx7j-xvrm- CVSS 4.0
- 4.6 Medium
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 - Weakness
- CWE-79
- Updated
- 2026-12-01
OSVRHSA-2026:104146CVSS 3.15.5
Red Hat Security Advisory: Red Hat Hardened Images RPMs bug fix and enhancement update
- Record
RHSA-2026:104146- CVSS 3.1
- 5.5 Medium
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N - Updated
- 2026-12-02
OSVUBUNTU-CVE-2026-140394No score
(Hugo after 0.140.2 and before 0.170.0 contains a stored cross-site scr ...)
- Record
UBUNTU-CVE-2026-140394- Updated
- 2026-12-03
History
Recorded by Every CVE
| Day | Changed | Sources |
|---|---|---|
| Affected packages, other IDs, references | OSV | |
| Affected packages, other IDs, references | OSV | |
| Affected packages, other IDs, references | EUVD, OSV | |
| Affected packages, other IDs, key facts, published date, references, severity | NVD, OSV | |
| Other IDs, published date | EUVD | |
| Other IDs, references, severity | GitHub Advisories | |
| Key facts, references | CVE List | |
| Severity | NVD | |
| First indexed | CVE List | |
| Affected packages, references | OSV | |
| First indexed | GitHub Advisories |
Upstream dates may differ.
References
github.com/gohugoio/hugo/security/advisories/GHSA-4whp-jx7j-xvrm
vulncheck.com/advisories/hugo-0.140.2-before-0.170.0-stored-xss-via-highlight-shortcode-wrapperclass
nvd.nist.gov/vuln/detail/CVE-2026-140394
github.com/advisories/GHSA-332r-53xh-x52j
github.com/gohugoio/hugo/pull/15564
github.com/gohugoio/hugo/commit/bdde5aa5155c6c349a743e71dc846bef754b6773
github.com/gohugoio/hugo/releases/tag/v0.170.0
github.com/advisories/GHSA-4whp-jx7j-xvrm
Show 17 more referencesShow less
github.com/CVEProject/cvelistV5/tree/main/cves/2026/140xxx/CVE-2026-140394.json
security-tracker.debian.org/tracker/CVE-2026-140394
github.com/gohugoio/hugo
access.redhat.com/errata/RHSA-2026:104146
images.redhat.com
access.redhat.com/security/cve/CVE-2026-140395
access.redhat.com/security/updates/classification
access.redhat.com/security/cve/CVE-2026-140394
security.access.redhat.com/data/csaf/v2/advisories/2026/rhsa-2026_104146.json
bugzilla.redhat.com/show_bug.cgi?id=2587938
cve.org/CVERecord?id=CVE-2026-140394
bugzilla.redhat.com/show_bug.cgi?id=2587951
cve.org/CVERecord?id=CVE-2026-140395
nvd.nist.gov/vuln/detail/CVE-2026-140395
github.com/gohugoio/hugo/security/advisories/GHSA-r48v-r4vw-h9v8
vulncheck.com/advisories/hugo-0.56.0-before-0.170.0-path-traversal-via-vendor-modules-txt
ubuntu.com/security/CVE-2026-140394