nday
GHSA-4whp-jx7j-xvrm

Hugo highlight wrapperClass option allows stored cross-site scripting

Correctif recensé le jour même de la divulgation. Version corrigée : github.com/gohugoio/hugo 0.170.0. Cette vulnérabilité ne figure dans aucune des quatre sources de PoC. Aucune inscription au catalogue KEV de la CISA à ce jour.

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
étape actuelle
PAT
divulgation
délai avant correctif
T+0d
CVSS
4.6 MEDIUM v4.0

Cycle de vie

Axe en UTC ; point = minute exacte, barre large = date seule, creux = inconnue ou déduite.
date inconnue
DISdivulguée
12-01T02:24Z
PATcorrectif
12-01T03:01Z
ANAanalyse
aucune donnée
POCPoC
aucune donnée
ITWexploitée
aucune donnée
KEVKEV
aucune donnée

Résumé

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

Journal des événements

+DISdivulgation

ghsa a signalé une divulgation.

source ghsa · observé en direct par nday le · brut
{
  "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
  }
}
source non datée ; vu en direct par nday
+PATcorrectif disponible

L’avis indique la version corrigée github.com/gohugoio/hugo 0.170.0. L’avis renvoie vers les commits de correction. Avis publié le  ; la date de publication du correctif lui-même n’est pas renseignée.

source ghsa · observé en direct par nday le · brut
{
  "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.