GHSA-r48v-r4vw-h9v8

Suggest an improvement
Source
https://github.com/advisories/GHSA-r48v-r4vw-h9v8
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-r48v-r4vw-h9v8/GHSA-r48v-r4vw-h9v8.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-r48v-r4vw-h9v8
Published
2026-12-01T02:23:54Z
Modified
2026-12-01T02:30:03Z
Severity
  • 6.7 (Medium) CVSS_V4 - 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 Calculator
Summary
Hugo: Build-host file disclosure through path traversal in vendored module metadata
Details

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.

Database specific
{
    "cwe_ids":  [
        "CWE-22"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-12-01T02:23:54Z",
    "nvd_published_at":  null,
    "severity":  "MODERATE"
}
References

Affected packages

Go / github.com/gohugoio/hugo

Package

Name
github.com/gohugoio/hugo
View open source insights on deps.dev
Purl
pkg:golang/github.com/gohugoio/hugo

Affected ranges

Type
SEMVER
Events
Introduced
0.56.0
Fixed
0.170.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/12/GHSA-r48v-r4vw-h9v8/GHSA-r48v-r4vw-h9v8.json"