nday
GHSA-r48v-r4vw-h9v8

Hugo: Build-host file disclosure through path traversal in vendored module metadata

公開当日に修正版が確認されています。修正済みバージョンは github.com/gohugoio/hugo 0.170.0 です。4 つの PoC ソースのいずれにも未掲載です。CISA KEV には現時点で未掲載です。

tags weakness typepath traversal 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.

path traversal
CWE-22, stated by GitHub advisory GHSA-r48v-r4vw-h9v8
local
AV:L in CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N (CVSS 4.0) from GitHub advisory GHSA-r48v-r4vw-h9v8
no authentication required
PR:N in CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N (CVSS 4.0) from GitHub advisory GHSA-r48v-r4vw-h9v8
Go
GHSA-r48v-r4vw-h9v8: go packages github.com/gohugoio/hugo
現在の段階
PAT
公開日時
公開から修正版まで
T+0d
CVSS 基本値
6.7 MEDIUM v4.0

ライフサイクル

横軸は UTC。点=分単位、幅広の帯=日付のみ、白抜き=不明または推定。
日時不明
DIS公開
12-01T02:23Z
PAT修正
12-01T03:01Z
ANA解析
記録なし
POCPoC
記録なし
ITW悪用
記録なし
KEVKEV
記録なし

概要

### Summary

A theme or module can ship a _vendor/modules.txt with an import path containing .. segments. Hugo used this path as the module's root directory without checking that it stays inside _vendor, so a malicious theme can make Hugo treat any directory on the build host (up to /) as its module root and read files from it.

### Details

collectModulesTXT in modules/collect.go builds the vendored module directory with filepath.Join(vendorDir, path), where path comes straight from _vendor/modules.txt. When an import resolves through the vendor list, Hugo uses that directory as is and skips the checks that normally keep a theme under themesDir. The resulting root is added to Hugo's filesystem overlay, which makes files outside the project available to readFile, resources.Get, os.ReadFile and mounts (e.g. a static mount that publishes the directory).

The fix rejects any modules.txt path that is not local (filepath.IsLocal), so the build fails with an invalid module path error.

### Proof of concept

A site uses an untrusted theme (theme = "evil"). The theme imports ../../../.. and lists the same path in its _vendor/modules.txt. A template then calls readFile on a path relative to the escaped root, e.g. a file outside the project or a system file such as etc/passwd. Its content ends up in the generated site.

### Impact

Anyone building a site with an untrusted theme or module, for example in CI or on a hosted build service, can have files on the build host read and published in the site. This includes secrets, credentials and system files. No change to the site configuration beyond importing the theme is needed.

Original text of GitHub advisory GHSA-r48v-r4vw-h9v8, 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:H/VI:N/VA:N/SC:N/SI:N/SA:N

CVSS 4.0 vector from GitHub advisory GHSA-r48v-r4vw-h9v8.

イベント履歴

+DIS公開

ghsa が公開を報告。

出典 ghsa · nday が にリアルタイムで観測 · 生データ
{
  "id": 563252,
  "type": "disclosed",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-r48v-r4vw-h9v8",
  "occurred_at": "2026-12-01T02:23:54Z",
  "observed_at": "2026-12-01T03:01:52.315373Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-r48v-r4vw-h9v8",
  "detail": {
    "state": "PUBLISHED",
    "ghsa_id": "GHSA-r48v-r4vw-h9v8",
    "withdrawn_at": null
  }
}
ソースに時刻なし、nday が観測
+PAT修正版公開

アドバイザリ記載の修正済みバージョン:github.com/gohugoio/hugo 0.170.0。修正コミットへのリンクあり。アドバイザリの公開は 。修正版そのもののリリース日時は記録なし。

出典 ghsa · nday が にリアルタイムで観測 · 生データ
{
  "id": 563253,
  "type": "patch_released",
  "source": "ghsa",
  "url": "https://github.com/advisories/GHSA-r48v-r4vw-h9v8",
  "occurred_at": null,
  "observed_at": "2026-12-01T03:01:52.315373Z",
  "is_backfill": false,
  "dedupe_key": "GHSA-r48v-r4vw-h9v8",
  "detail": {
    "cvss": {
      "cvss_v3": {
        "score": 0.0,
        "vector_string": null
      },
      "cvss_v4": {
        "score": 6.7,
        "vector_string": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
      }
    },
    "cwes": [
      {
        "name": "Improper Limitation of a Pathname to a Restricted Directory",
        "cwe_id": "CWE-22"
      }
    ],
    "ghsa_id": "GHSA-r48v-r4vw-h9v8",
    "packages": [
      {
        "name": "github.com/gohugoio/hugo",
        "ecosystem": "go",
        "first_patched_version": "0.170.0",
        "vulnerable_version_range": ">= 0.56.0, < 0.170.0"
      }
    ],
    "severity": "medium",
    "references": [
      "https://github.com/gohugoio/hugo/security/advisories/GHSA-r48v-r4vw-h9v8",
      "https://github.com/gohugoio/hugo/pull/15564",
      "https://github.com/gohugoio/hugo/commit/d41a8a196e6b2fd5e5aa886c790d6c679dd73be0",
      "https://github.com/gohugoio/hugo/releases/tag/v0.170.0",
      "https://github.com/advisories/GHSA-r48v-r4vw-h9v8"
    ],
    "fix_commit_urls": [
      "https://github.com/gohugoio/hugo/pull/15564",
      "https://github.com/gohugoio/hugo/commit/d41a8a196e6b2fd5e5aa886c790d6c679dd73be0"
    ],
    "github_reviewed_at": "2026-12-01T02:23:54Z",
    "advisory_updated_at": "2026-12-01T02:23:55Z",
    "source_code_location": "https://github.com/gohugoio/hugo",
    "advisory_published_at": "2026-12-01T02:23:54Z"
  }
}

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.