nday
GHSA-4whp-jx7j-xvrm

Hugo highlight wrapperClass option allows stored cross-site scripting

揭露當天即有修補紀錄。已於 github.com/gohugoio/hugo 0.170.0 修補。四個 PoC 來源皆未收錄。目前未列入 CISA KEV。

tags weakness typeXSS accesslocalno authentication required ecosystemGo
why these tags

nday derives these tags by fixed rules from the facts below; NVD, the CNA and other sources do not assign them. Vocabulary and rules: ~/tags.

XSS
CWE-79, stated by GitHub advisory GHSA-4whp-jx7j-xvrm
local
AV:L in 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 (CVSS 4.0) from GitHub advisory GHSA-4whp-jx7j-xvrm
no authentication required
PR:N in 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 (CVSS 4.0) from GitHub advisory GHSA-4whp-jx7j-xvrm
Go
GHSA-4whp-jx7j-xvrm: go packages github.com/gohugoio/hugo
目前階段
PAT
揭露時間
揭露 → 修補
T+0d
CVSS
4.6 MEDIUM v4.0

生命週期

橫軸 UTC;點=精確到分鐘,寬條=僅日期,空心=不明或推斷。
時間不明
DIS揭露
12-01T02:24Z
PAT修補
12-01T03:01Z
ANA分析
尚無紀錄
POCPoC
尚無紀錄
ITW遭利用
尚無紀錄
KEVKEV
尚無紀錄

摘要

### 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.

Original text of GitHub advisory GHSA-4whp-jx7j-xvrm, shown as published.

Exploit conditions

What an attack needs, read from the CVSS vector.
Attack vector AV:L
Local: needs a local or SSH session, or a user tricked into acting on the machine
Attack complexity AC:L
Low: no target-specific security measures to get around
Attack requirements AT:N
None: success does not depend on how the target is deployed or running
Privileges required PR:N
None: no account or authorization needed
User interaction UI:A
Active: a user must deliberately do something specific, such as install or run a file or dismiss a warning

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

CVSS 4.0 vector from GitHub advisory GHSA-4whp-jx7j-xvrm.

事件紀錄

+DIS揭露

ghsa 回報一筆揭露事件。

來源 ghsa · nday 於 即時觀測 · 原始
{
  "id": 563246,
  "type": "disclosed",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-4whp-jx7j-xvrm",
  "occurred_at": "2026-12-01T02:24:46Z",
  "observed_at": "2026-12-01T03:01:52.315373Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-4whp-jx7j-xvrm",
  "detail": {
    "state": "PUBLISHED",
    "ghsa_id": "GHSA-4whp-jx7j-xvrm",
    "withdrawn_at": null
  }
}
來源無時間;nday 即時觀測
+PAT已有修補

公告列出的修補版本:github.com/gohugoio/hugo 0.170.0。公告附有修補 commit。公告發布於 ;修補本身的釋出時間沒有紀錄。

來源 ghsa · nday 於 即時觀測 · 原始
{
  "id": 563247,
  "type": "patch_released",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-4whp-jx7j-xvrm",
  "occurred_at": null,
  "observed_at": "2026-12-01T03:01:52.315373Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-4whp-jx7j-xvrm",
  "detail": {
    "cvss": {
      "cvss_v3": {
        "score": 0.0,
        "vector_string": null
      },
      "cvss_v4": {
        "score": 4.6,
        "vector_string": "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"
      }
    },
    "cwes": [
      {
        "name": "Improper Neutralization of Input During Web Page Generation",
        "cwe_id": "CWE-79"
      }
    ],
    "ghsa_id": "GHSA-4whp-jx7j-xvrm",
    "packages": [
      {
        "name": "github.com/gohugoio/hugo",
        "ecosystem": "go",
        "first_patched_version": "0.170.0",
        "vulnerable_version_range": ">= 0.140.2, < 0.170.0"
      }
    ],
    "severity": "medium",
    "references": [
      "https://github.com/gohugoio/hugo/security/advisories/GHSA-4whp-jx7j-xvrm",
      "https://github.com/gohugoio/hugo/pull/15564",
      "https://github.com/gohugoio/hugo/commit/bdde5aa5155c6c349a743e71dc846bef754b6773",
      "https://github.com/gohugoio/hugo/releases/tag/v0.170.0",
      "https://github.com/advisories/GHSA-4whp-jx7j-xvrm"
    ],
    "fix_commit_urls": [
      "https://github.com/gohugoio/hugo/pull/15564",
      "https://github.com/gohugoio/hugo/commit/bdde5aa5155c6c349a743e71dc846bef754b6773"
    ],
    "github_reviewed_at": "2026-12-01T02:24:46Z",
    "advisory_updated_at": "2026-12-01T02:24:46Z",
    "source_code_location": "https://github.com/gohugoio/hugo",
    "advisory_published_at": "2026-12-01T02:24:46Z"
  }
}

Report an error

report an error or omission

Something on this page wrong or missing? Tell the editors; if they accept it, this page's revision log says so publicly. Upstream data is not changed.

Discussion

0 comments

No comments yet.