{"id":"GHSA-r73q-gwx2-fpxm","aliases":["GHSA-r73q-gwx2-fpxm"],"related":[],"kind":"vulnerability","state":"published","title":"Hugo theme-defined module replacements bypass mount restrictions and widen the Node.js read sandbox","summary":"### Summary\n\nA theme or module could define its own `module.replacements` and mount directories anywhere on the host.\n\n### Details\n\nA 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.\n\nMounting 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.\n\nOnly sites that use an untrusted theme or module are affected.\n\n### Proof of concept\n\nCreate a theme as outlined in the Go test below:\n\n```go\nfunc TestMountRestrictThemeReplacements(t *testing.T) {\n    files := `\n-- hugo.toml --\ndisableKinds = [\"taxonomy\", \"term\", \"rss\"]\ntheme = \"mytheme\"\n-- themes/mytheme/hugo.toml --\n[module]\nreplacements = \"evil -> ../../secret\"\n[[module.imports]]\npath = \"evil\"\n[[module.imports.mounts]]\nsource = \".\"\ntarget = \"assets\"\n-- secret/file1.txt --\nfile1\n-- layouts/all.html --\nAll.\n`\n    b, err := hugolib.TestE(t, files)\n    b.Assert(err, qt.IsNotNil)\n    b.Assert(err.Error(), qt.Contains, `module \"evil\" not found in \"/themes/evil\"`)\n}\n```\n\n### Impact\n\nA theme could read files outside its sandbox.","summaryFormat":"markdown","summarySource":"ghsa","descriptions":[{"lang":"en","text":"### Summary\n\nA theme or module could define its own `module.replacements` and mount directories anywhere on the host.\n\n### Details\n\nA 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.\n\nMounting 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.\n\nOnly sites that use an untrusted theme or module are affected.\n\n### Proof of concept\n\nCreate a theme as outlined in the Go test below:\n\n```go\nfunc TestMountRestrictThemeReplacements(t *testing.T) {\n    files := `\n-- hugo.toml --\ndisableKinds = [\"taxonomy\", \"term\", \"rss\"]\ntheme = \"mytheme\"\n-- themes/mytheme/hugo.toml --\n[module]\nreplacements = \"evil -> ../../secret\"\n[[module.imports]]\npath = \"evil\"\n[[module.imports.mounts]]\nsource = \".\"\ntarget = \"assets\"\n-- secret/file1.txt --\nfile1\n-- layouts/all.html --\nAll.\n`\n    b, err := hugolib.TestE(t, files)\n    b.Assert(err, qt.IsNotNil)\n    b.Assert(err.Error(), qt.Contains, `module \"evil\" not found in \"/themes/evil\"`)\n}\n```\n\n### Impact\n\nA theme could read files outside its sandbox.","format":"markdown","source":"ghsa"}],"published":"2026-11-30T21:49:32.000Z","modified":"2026-11-30T22:00:05.264Z","severity":{"scorer":"GitHub","scheme":"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","rating":"MEDIUM"},"severities":[{"scorer":"GitHub","scheme":"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","rating":"MEDIUM"}],"cwes":["CWE-863"],"affected":[{"ranges":[{"type":"semver","introduced":"0.152.0","status":"affected","fixed":"0.168.0"}],"ecosystem":"Go","package":"github.com/gohugoio/hugo","purl":"pkg:golang/github.com/gohugoio/hugo","source":"ghsa"}],"references":[{"url":"https://github.com/gohugoio/hugo/security/advisories/GHSA-r73q-gwx2-fpxm","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gohugoio/hugo/pull/15426","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gohugoio/hugo/commit/6883b55ad59e0daa1aaba0cf2b66db1132202e2c","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/gohugoio/hugo","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/gohugoio/hugo/releases/tag/v0.168.0","tags":["web"],"sources":["ghsa"]}],"credits":[],"sources":[{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-r73q-gwx2-fpxm","url":"https://github.com/advisories/GHSA-r73q-gwx2-fpxm","licence":"CC-BY-4.0","modified":"2026-11-30T22:00:05.264Z"}],"updatedAt":"2026-11-30T22:07:24.979Z"}