GHSA-r48v-r4vw-h9v8: Hugo Path Traversal Vulnerability
MODERATEGHSA-r48v-r4vw-h9v8 is a MODERATE path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Hugo libraries in the Go ecosystem. The issue involves build-host file disclosure through path traversal in vendored module metadata. Remediation is available by upgrading affected packages to version 0.170.0.
GHSA-r48v-r4vw-h9v8 at a Glance
How to Fix GHSA-r48v-r4vw-h9v8
To remediate this vulnerability, upgrade all affected Hugo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/gohugoio/hugo to 0.170.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/gohugoio/hugo
How to Check if You Are Affected
To determine whether your application is affected by GHSA-r48v-r4vw-h9v8, inspect your project dependencies for Hugo:
inspect dependencies for github.com/gohugoio/hugo
Analyze the terminal output to locate any version of Hugo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.170.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Hugo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
GHSA-r48v-r4vw-h9v8 Affected Hugo Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/gohugoio/hugo
|
Go |
≥ 0.56.0
< 0.170.0
|
0.170.0
|
References
Frequently Asked Questions
What is GHSA-r48v-r4vw-h9v8?
Which Hugo versions are affected?
What version fixes GHSA-r48v-r4vw-h9v8?
Is github.com/gohugoio/hugo affected?
What CWE is associated with GHSA-r48v-r4vw-h9v8?
How can I check Go dependencies for GHSA-r48v-r4vw-h9v8?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r48v-r4vw-h9v8",
"modified" : "2026-12-01T02:23:55Z",
"published" : "2026-12-01T02:23:54Z",
"aliases" : [ ],
"summary" : "Hugo: Build-host file disclosure through path traversal in vendored module metadata",
"details" : "### Summary\n\nA 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.\n\n### Details\n\n`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).\n\nThe fix rejects any `modules.txt` path that is not local (`filepath.IsLocal`), so the build fails with an `invalid module path` error.\n\n### Proof of concept\n\nA 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.\n\n\n### Impact\n\nAnyone 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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/gohugoio/hugo"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.56.0"
}, {
"fixed" : "0.170.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/gohugoio/hugo/security/advisories/GHSA-r48v-r4vw-h9v8"
}, {
"type" : "WEB",
"url" : "https://github.com/gohugoio/hugo/pull/15564"
}, {
"type" : "WEB",
"url" : "https://github.com/gohugoio/hugo/commit/d41a8a196e6b2fd5e5aa886c790d6c679dd73be0"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/gohugoio/hugo"
}, {
"type" : "WEB",
"url" : "https://github.com/gohugoio/hugo/releases/tag/v0.170.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-12-01T02:23:54Z",
"nvd_published_at" : null
}
}