Theme replacements in Hugo bypass mount restrictions and read files
Key facts
- Attack vector
- Local
- Privileges required
- None
- User interaction
- Active
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Security bypass
- Confidentiality · integrity · availability
- High · None · None
- Fix status
- Fixed
Attack profile from CVSS 4.0 · GHSA-r73q-gwx2-fpxm. Fix status from GitHub. Impact type from CWE-863.
Summary
Hugo, the Go static site generator, lets a theme or module define its own module.replacements in versions from 0.152.0 before 0.168.0 when the project sets none. A crafted theme can mount a directory anywhere on the host, which bypasses the rule that theme mount sources must be local paths. When the directory is mounted as assets, it is also added to the Node.js read roots, so Node tools can read files outside the sandbox. An attacker who controls an untrusted theme or module can read files outside its sandbox, and only sites using such a theme or module are affected.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
Description from the GitHub advisory
### 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: ```go 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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| — | github.com/gohugoio/hugo (Go) | 0.152.0 to before 0.168.0 | 0.168.0 | Patch available | GHSA-r73q-gwx2-fpxm |
- github.com/gohugoio/hugo (Go) Vendor— Affected 0.152.0 to before 0.168.0 Fixed in 0.168.0 Patch available GHSA-r73q-gwx2-fpxm
Remediation
Upgrade github.com/gohugoio/hugo to version 0.168.0 or later, which fixes the issue. The sources list no advisory identifier for this fix.
Written with Claude Haiku 5.5 from the sources below · 2026-11-30
- Fix · GHSA-r73q-gwx2-fpxm github.com/gohugoio/hugo (Go) Fixed in 0.168.0 Advisory →
Timeline
- 2026-11-30 Threatist record created from GHSA-r73q-gwx2-fpxm
References
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences