Every CVESearch/Get API key

CVE-2026-140394

Hugo 0.140.2 before 0.170.0 Stored XSS via highlight shortcode wrapperClass

Explain with AI
ChatGPTClaudeGoogle AI
Severity
5.1Medium
Network attack, low privileges, needs user interactionCVSS 4.0, CVE ListGitHub Advisories gives 4.6
Exploitation
Proof of concept
CISA reports one, no source links it
Exploit chance
0.41% in 30 days
Percentile37th
EPSS, scored
Listed fix
0.170.0 for 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:N

Exploit chance over time

Unchanged since Dec 2, 2026
EPSS score 0.41% every day from Dec 2, 2026 to Dec 4, 2026.

Affected

Packages 9

Affected packages
PackageAffectedFixed
github.com/gohugoio/hugo
Go
0.140.2 up to 0.170.0
0.170.0
hugo
Debian: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 less
0.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
hugo
Ubuntu: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
hugo
Ubuntu: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
hugo
Ubuntu:20.04:LTS
All versions, plus listed versions
0.57.2-10.58.3-10.59.1-1.10.68.3-1
None listed
hugo
Ubuntu: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 less
0.91.2-10.92.0-10.92.1-1build10.92.2-10.92.2-1ubuntu0.1
None listed
hugo
Ubuntu: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 less
0.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
hugo
Ubuntu:26.10
All versions, plus listed versions
0.154.5-10.162.1-50.162.1-7
None listed
hugo
Ubuntu: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.

Packages named only by advisories that cover several CVEs
PackageAffectedFixed
hugo
Red 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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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 MediumCVSS: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

Changes recorded by Every CVE
DayChangedSources
Affected packages, other IDs, referencesOSV
Affected packages, other IDs, referencesOSV
Affected packages, other IDs, referencesEUVD, OSV
Affected packages, other IDs, key facts, published date, references, severityNVD, OSV
Other IDs, published dateEUVD
Other IDs, references, severityGitHub Advisories
Key facts, referencesCVE List
SeverityNVD
First indexedCVE List
Affected packages, referencesOSV
First indexedGitHub Advisories

Upstream dates may differ.

References

Show 17 more referencesShow less
MoveEnter Open