MEDIUM · CVSS 4.0 CWE-22

GHSA-r48v-r4vw-h9v8: Hugo: Build-host file disclosure through path traversal in vendored module metadata

Published 2026-12-01 · Updated 2026-12-01

Summary

Hugo contains a path traversal vulnerability in vendored module metadata processing that allows a malicious theme or module to read files on the build host. Engineering teams and developers using Hugo with untrusted themes or modules must update their software.

Who is affected

Affected deployments are those building sites using untrusted themes or modules, particularly in CI environments or hosted build services. A malicious theme can ship a crafted `_vendor/modules.txt` with path traversal segments to make Hugo treat any directory on the build host up to root as a module root, reading files such as secrets, credentials, and system files and publishing them in the generated site.

Exploitability

The vulnerability requires local access with low attack complexity and user interaction, with high confidentiality impact on the vulnerable component and no integrity or availability impact. EPSS is not yet available and CISA KEV active exploitation is no.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-12-01. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Go github.com/gohugoio/hugo >= 0.56.0, < 0.170.0 0.170.0 go get github.com/gohugoio/[email protected]

CVSS 4.0 vector

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

Attack vectorLocal
Attack complexityLow
Attack requirementsNone
Privileges requiredNone
User interactionActive
Confidentiality (vulnerable system)High
Integrity (vulnerable system)None
Availability (vulnerable system)None
Confidentiality (subsequent systems)None
Integrity (subsequent systems)None
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

What causes the path traversal in Hugo?

Hugo uses import paths from `_vendor/modules.txt` containing `..` segments without verifying that the resulting directory stays inside the vendor folder.

What versions of Hugo are affected?

Go package github.com/gohugoio/hugo introduced in version 0.56.0 and fixed in 0.170.0 are affected.

What is the remediation for this vulnerability?

Upgrade github.com/gohugoio/hugo to version 0.170.0 or later.

Original advisory description
### 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.

References

Source records: GHSA-r48v-r4vw-h9v8 (OSV.dev).