nday
GHSA-r48v-r4vw-h9v8

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

披露当天有补丁记录。已有补丁记录,修复版本是 github.com/gohugoio/hugo 0.170.0。四个 PoC 来源都还没有收录。尚未列入 CISA KEV。

标签 漏洞类型path traversal 攻击途径本地无需认证 软件包生态Go
这些标签的依据

这些标签由 nday 按固定规则从下列事实自动推导,不是 NVD、编号分配方或其他来源给出的。全部标签和规则见 ~/tags。

path traversal
CWE-22(来源:GitHub 公告 GHSA-r48v-r4vw-h9v8)
本地
GitHub 公告 GHSA-r48v-r4vw-h9v8 给出的 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)中的 AV:L
无需认证
GitHub 公告 GHSA-r48v-r4vw-h9v8 给出的 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)中的 PR:N
Go
GHSA-r48v-r4vw-h9v8:go 包 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.

以上是 GitHub 安全公告 GHSA-r48v-r4vw-h9v8 中的原文,未经改写。

利用条件

按 CVSS 向量说明攻击需要的条件。
攻击途径 AV:L
本地:需要本地或 SSH 会话,或诱使用户在本机上操作
攻击复杂度 AC:L
低:不需要绕过目标特有的安全防护
攻击前提 AT:N
无:能否成功与目标的部署和运行条件无关
所需权限 PR:N
无:不需要账号或授权
用户交互 UI:A
主动:须有用户特意执行特定操作,例如安装或运行文件、忽略安全警告

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 向量,来自 GitHub 安全公告 GHSA-r48v-r4vw-h9v8。

事件记录

+DIS披露

ghsa 报告了披露事件。

来源 ghsa · 本站 实时观测 · 原始记录
{
  "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
  }
}
来源未给时间,本站实时观测
+PAT补丁发布

公告给出修复版本 github.com/gohugoio/hugo 0.170.0。公告附有修复提交。公告本身发布于 ,补丁实际发布时间没有记录。

来源 ghsa · 本站 实时观测 · 原始记录
{
  "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"
  }
}

纠错

报告错误或缺失

页面有误或缺失?告诉编辑;采纳后在本页修订记录公开说明,上游数据不会被改动。

讨论

0 条评论

还没有评论。