Description
Hugo's default fenced-code-block renderer writes attribute values taken from the code-fence info string into the rendered HTML without escaping them. New in markup/internal/attributes/attributes.go converts every attribute value from a byte slice to a string as it is stored, deliberately dropping the escaping that used to happen there, and RenderAttributes in the same file escapes only values that are still byte slices, so its escaping branch is never reached and every value is written verbatim. The function's documentation states that it performs HTML escaping of string attributes, which it does not. A quote inside an attribute value in the info string therefore terminates the attribute and allows a further attribute, including an event handler, to be placed on the wrapper element, and the script runs for every visitor who loads the page. This path is reached under the default configuration, with code fences enabled and without goldmark's unsafe setting or any custom render hook. Attribute names beginning with on are filtered when the attributes are parsed, so injection is achieved through the value rather than the name.
Published: 2026-08-24
Score: 4.8 Medium
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Hugo's default fenced‑code‑block renderer writes attribute values taken from the code‑fence info string into the rendered HTML without performing escaping. The change in the internal attributes module caused the escaping routine to never trigger for string attributes, allowing a quote inside an attribute value to terminate the attribute and insert a new event handler on the wrapper element. The injected script executes for every visitor who loads the affected page, giving an attacker persistent client‑side code execution with the privileges of the page visitor.

Affected Systems

The vulnerability affects Hugo versions 0.93.0 through 0.165.0, distributed by gohugoio. Any site built with one of these releases that contains or allows user‑generated markdown with fenced code blocks may be impacted. Sites that perform code‑block rendering with the default configuration, no unsafe goldmark option, and without custom render hooks are susceptible.

Risk and Exploitability

The CVSS score of 4.8 indicates a low to moderate severity. Because the EPSS score is not available and it is not listed in the CISA KEV catalog, there is no evidence of widespread exploitation yet. However, the attack can be performed without special privileges: an adversary only needs to place a malicious code fence in stored content, which makes this a straightforward stored XSS vector. The risk is mitigated by applying the latest patched version or by disabling the vulnerable rendering path.

Generated by OpenCVE AI on August 24, 2026 at 11:21 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Hugo to at least version 0.165.1 or later, where the attribute escaping logic has been restored.
  • If an upgrade is not immediately possible, disable fenced code block rendering in your Hugo configuration or remove any code fences that contain unescaped double quotes from your site content.
  • Alternatively, modify the markdown rendering hook or the internal attributes module to ensure that all attribute values are HTML‑escaped before rendering; custom render hooks can enforce this by sanitizing the info string.
  • Verify that Goldmark’s unsafe mode remains disabled and that no custom render hooks bypass the default sanitization.

Generated by OpenCVE AI on August 24, 2026 at 11:21 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 24 Aug 2026 11:30:00 +0000

Type Values Removed Values Added
First Time appeared Gohugo
Gohugo hugo
CPEs cpe:2.3:a:gohugo:hugo:*:*:*:*:*:*:*:*
Vendors & Products Gohugo
Gohugo hugo

Mon, 24 Aug 2026 10:45:00 +0000

Type Values Removed Values Added
Description Hugo's default fenced-code-block renderer writes attribute values taken from the code-fence info string into the rendered HTML without escaping them. New in markup/internal/attributes/attributes.go converts every attribute value from a byte slice to a string as it is stored, deliberately dropping the escaping that used to happen there, and RenderAttributes in the same file escapes only values that are still byte slices, so its escaping branch is never reached and every value is written verbatim. The function's documentation states that it performs HTML escaping of string attributes, which it does not. A quote inside an attribute value in the info string therefore terminates the attribute and allows a further attribute, including an event handler, to be placed on the wrapper element, and the script runs for every visitor who loads the page. This path is reached under the default configuration, with code fences enabled and without goldmark's unsafe setting or any custom render hook. Attribute names beginning with on are filtered when the attributes are parsed, so injection is achieved through the value rather than the name.
Title Hugo 0.93.0 through 0.165.0 Stored Cross-Site Scripting via Unescaped Code-Fence Attribute Values
Weaknesses CWE-79
References
Metrics cvssV3_1

{'score': 5.4, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N'}

cvssV4_0

{'score': 4.8, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:A/VC:L/VI:L/VA:N/SC:L/SI:L/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: VulnCheck

Published:

Updated: 2026-08-24T11:13:21.240Z

Reserved: 2026-06-02T13:53:48.666Z

Link: CVE-2026-10618

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-08-24T11:16:38.403

Modified: 2026-08-24T11:16:38.403

Link: CVE-2026-10618

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-24T11:30:03Z

Weaknesses
  • CWE-79

    Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')