Hugo theme-defined module replacements bypass mount restrictions and widen the Node.js read sandboxGHSA-r73q-gwx2-fpxm
Fix: gohugoio/hugo#15426GHSA-r73q-gwx2-fpxm is a security vulnerability in github.com/gohugoio/hugo. A fix is available for github.com/gohugoio/hugo — see the affected versions and patch details below.
Real-World Exposure
github.com/gohugoio/hugoReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects Go packages — download data is not available via public APIs for these ecosystems.
Description
Summary
A theme or module could define its own module.replacements and mount directories anywhere on the host.
Details
A theme or module could define its own module.replacements. If the project didn't set any replacements, Hugo applied the theme's replacements as if the project had set them. The theme could then import and mount a directory anywhere on the host, either by absolute path or by escaping themesDir with ../. This got around the rule that theme mount sources must be local paths.
Mounting such a directory as assets also added it to the Node.js --allow-fs-read roots. That widened the security.node.permissions sandbox. For example, Node tools such as css.PostCSS could read files from that directory and load JavaScript modules from it.
Only sites that use an untrusted theme or module are affected.
Proof of concept
Create a theme as outlined in the Go test below:
func TestMountRestrictThemeReplacements(t *testing.T) {
files := `
-- hugo.toml --
disableKinds = ["taxonomy", "term", "rss"]
theme = "mytheme"
-- themes/mytheme/hugo.toml --
[module]
replacements = "evil -> ../../secret"
[[module.imports]]
path = "evil"
[[module.imports.mounts]]
source = "."
target = "assets"
-- secret/file1.txt --
file1
-- layouts/all.html --
All.
`
b, err := hugolib.TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `module "evil" not found in "/themes/evil"`)
}
Impact
A theme could read files outside its sandbox.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐹Go | github.com/gohugoio/hugo | ≥ 0.152.0&&< 0.168.0 | 0.168.0go get github.com/gohugoio/hugo@v0.168.0 |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for github.com/gohugoio/hugo, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update github.com/gohugoio/hugo to 0.168.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms GHSA-r73q-gwx2-fpxm is resolved across your whole dependency graph.
Workarounds
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
Frequently Asked Questions
Is GHSA-r73q-gwx2-fpxm in your dependencies?
Find it across Go, including transitive dependencies.