CVE-2026-109597: Hugo stored cross-site scripting in Table of Contents heading IDs

CVE-2026-109597 · Severity: medium · CVSS 5.4 · Published 2026-10-12

Hugo is a static site generator that converts Markdown and other content into websites. A stored cross-site scripting flaw allows content authors to inject malicious HTML and JavaScript into pages through crafted heading IDs in Markdown. Sites that build untrusted or third-party content and display a table of contents are vulnerable to having malicious scripts execute in visitors' browsers.

Technologies: Gohugoio Hugo. Vendors: Gohugoio.

Quick answers

Is CVE-2026-109597 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-109597 being exploited in the wild.
How severe is CVE-2026-109597?
Medium severity, with a CVSS score of 5.4, published 12 October 2026.
Which products and versions are affected?
Gohugoio Hugo v0.60.0 through v0.166.0.
Is there a fix for CVE-2026-109597?
Yes: fixed in v0.167.0. Until then: Do not render .TableOfContents or .Fragments.ToHTML for untrusted or third-party Markdown content, or implement validation of heading IDs in a content pipeline before building. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-109597 attacked?
It is attacked over the network, in a web application.
Am I affected by CVE-2026-109597?
Check whether you run Gohugoio Hugo at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • Fixed in: v0.167.0

Do not render .TableOfContents or .Fragments.ToHTML for untrusted or third-party Markdown content, or implement validation of heading IDs in a content pipeline before building.

Technical details

The vulnerability exists in Hugo's Table of Contents generation (.TableOfContents and .Fragments.ToHTML), where explicit heading IDs from Markdown (e.g., ## Intro {id="..."}) are written unescaped into the href attribute of generated HTML. An attacker with Markdown authoring access can break out of the attribute context and inject arbitrary HTML elements with event handlers. The heading element itself was properly escaped; only the ToC output was affected. This requires attacker control over Markdown content processed by Hugo.

Affected products

  • gohugoio Hugo v0.60.0 through v0.166.0

Timeline

  • 2026-09-28: disclosed
  • 2026-10-12: advisory

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.