Nov 30, 2026·10 min read·2 visits
A flaw in Hugo's module configuration parser allows untrusted themes to define module.replacements when the root project leaves them unset. This marks theme imports as trusted project replacements, bypassing directory traversal checks (CWE-22) and allowing arbitrary host paths to be mounted into the site build and Node.js asset pipeline. Upgrade to Hugo v0.168.0 to remediate.
Hugo versions 0.152.0 through 0.167.x contain a path traversal and sandbox bypass vulnerability in the module configuration loader. When a root project does not define module replacements, Hugo permits imported themes or modules to define their own module.replacements directives. Because replaced module imports are internally marked as project-replaced, they bypass theme directory path restrictions, allowing an untrusted theme to mount arbitrary host filesystem directories and expand the Node.js read sandbox.
Hugo (github.com/gohugoio/hugo) is a static site generator written in Go that supports modular site architectures through Hugo Modules and third-party themes. To safely process untrusted third-party themes, Hugo implements a virtual file system (hugofs) and enforces strict directory sandboxing. While the root project configuration (hugo.toml) is granted elevated trust to mount arbitrary directories on the host file system, imported themes and modules are restricted to mounting files strictly within their designated theme subdirectory.
In Hugo versions starting from v0.152.0 and prior to v0.168.0, an architectural flaw in the module configuration decoding logic allows third-party themes to bypass this directory containment policy. Specifically, the applyThemeConfig function in modules/collect.go fails to isolate the module.replacements configuration setting between the root project and child themes when the root project does not explicitly configure any module replacements.
This flaw is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and CWE-552 (Files or Directories Accessible to External Parties). When a theme supplies its own module.replacements entry, Hugo applies the replacement mapping and flags the resulting module import as a trusted project-level replacement (pathProjectReplaced = true).
Consequently, the path validation routine createThemeDirname disables both absolute path rejection and relative path traversal (../) validation. An attacker supplying a malicious theme can mount arbitrary directories from the host operating system into the Hugo virtual file system. Furthermore, mounting external host directories under the assets target automatically expands the --allow-fs-read permission boundary for Node.js subprocesses, exposing sensitive host files to external asset processors such as PostCSS.
The root cause of GHSA-r73q-gwx2-fpxm resides in how Hugo propagates the project-level replacementsMap during theme initialization and how downstream path resolution interprets replaced module flags. In Hugo's module system, module.replacements is intended strictly as a root project directive used during local development to redirect remote module paths to local file system paths.
When Hugo initializes a site build, it first decodes the primary project's module configuration and stores any path replacement mappings in c.moduleConfig.replacementsMap. If the primary project does not define a replacements key in its [module] configuration block, c.moduleConfig.replacementsMap remains nil. Subsequently, when Hugo loads imported themes or component modules, the collector invokes applyThemeConfig in modules/collect.go, passing c.moduleConfig.replacementsMap directly to decodeConfig (modules/config.go).
Inside decodeConfig, the function assigns the passed pathReplacements parameter to c.replacementsMap and then uses mapstructure.WeakDecode to unmarshal the theme's own [module] configuration block into the Config struct c. Immediately following this decode operation, decodeConfig checks if c.replacementsMap == nil. Because the root project left this map uninitialized (nil), decodeConfig assumes it is parsing a root configuration and proceeds to parse c.Replacements—which was just populated from the untrusted theme's configuration file.
Once the theme's replacement strings (old_path -> new_path) are compiled into c.replacementsMap, decodeConfig iterates over the theme's c.Imports slice. For every import path matching a key in c.replacementsMap, Hugo overwrites imp.Path with the replacement target and sets the internal boolean flag imp.pathProjectReplaced = true. This flag signals to the rest of the module loader that the root project explicitly authorized a local path override.
When getAndCreateModule (modules/collect.go) later resolves the filesystem location for the module via createThemeDirname(modulePath, owner.projectMod || moduleImport.pathProjectReplaced), the second parameter (isProjectMod) evaluates to true. Inside createThemeDirname (modules/client.go), an isProjectMod == true state grants two exemptions:
filepath.IsAbs(modulePath) is true, the function immediately returns the raw absolute path rather than returning an error.filepath.Join(c.ccfg.ThemesDir, modulePath), the prefix check !strings.HasPrefix(moduleDir, c.ccfg.ThemesDir) is short-circuited by !isProjectMod, allowing ../ sequences to traverse arbitrarily far above the themesDir root.Examining the interaction between modules/config.go, modules/client.go, and the patched modules/collect.go illustrates how the state confusion occurs and how the upstream patch prevents it.
In modules/config.go, decodeConfig handles both project-level and theme-level configurations. The distinction between the two relies on the pathReplacements map passed by the caller:
func decodeConfig(logger logg.Logger, cfg config.Provider, pathReplacements map[string]string) (Config, error) {
c := DefaultModuleConfig
c.replacementsMap = pathReplacements
// ...
if moduleSet {
m := cfg.GetStringMap("module")
if err := mapstructure.WeakDecode(m, &c); err != nil {
return c, err
}
// FLAW: When pathReplacements is nil (because the root project declared none),
// c.Replacements decoded from a theme's cfg is processed here.
if c.replacementsMap == nil {
if len(c.Replacements) == 1 {
c.Replacements = strings.Split(c.Replacements[0], ",")
}
// ... parses theme's c.Replacements into c.replacementsMap ...
}
if c.replacementsMap != nil && c.Imports != nil {
for i, imp := range c.Imports {
if newImp, found := c.replacementsMap[imp.Path]; found {
imp.Path = newImp
// Marks the theme import as replaced by the root project
imp.pathProjectReplaced = true
c.Imports[i] = imp
}
}
}
}When the module collector resolves the physical directory of an imported non-Go module in modules/client.go, createThemeDirname relies entirely on isProjectMod (which receives owner.projectMod || moduleImport.pathProjectReplaced) to enforce containment within c.ccfg.ThemesDir:
func (c *Client) createThemeDirname(modulePath string, isProjectMod bool) (string, error) {
invalid := fmt.Errorf("invalid module path %q; must be relative to themesDir when defined outside of the project", modulePath)
modulePath = filepath.Clean(modulePath)
if filepath.IsAbs(modulePath) {
if isProjectMod {
return modulePath, nil // Exemption 1: Absolute host paths allowed
}
return "", invalid
}
moduleDir := filepath.Join(c.ccfg.ThemesDir, modulePath)
if !isProjectMod && !strings.HasPrefix(moduleDir, c.ccfg.ThemesDir) {
return "", invalid // Exemption 2: Directory traversal check skipped when isProjectMod == true
}
return moduleDir, nil
}The official patch in commit 6883b55ad59e0daa1aaba0cf2b66db1132202e2c modifies applyThemeConfig in modules/collect.go so that a non-nil replacements map is always passed to decodeConfig when processing theme configurations:
diff --git a/modules/collect.go b/modules/collect.go
index 5680f065c01..04d9c19ad79 100644
--- a/modules/collect.go
+++ b/modules/collect.go
@@ -527,7 +527,12 @@ LOOP:
}
}
- config, err := decodeConfig(c.logger.Logger(), tc.cfg, c.moduleConfig.replacementsMap)
+ // Only the project can define replacements.
+ replacements := c.moduleConfig.replacementsMap
+ if replacements == nil {
+ replacements = map[string]string{}
+ }
+ config, err := decodeConfig(c.logger.Logger(), tc.cfg, replacements)
if err != nil {
return err
}> [!NOTE]
> Assessment of Fix Completeness: In Go, an initialized empty map (map[string]string{}) is distinct from an uninitialized nil map (replacements == nil evaluates to false). By substituting a non-nil empty map whenever c.moduleConfig.replacementsMap is nil, the if c.replacementsMap == nil branch inside decodeConfig is unconditionally skipped for all theme and component module configurations. While mapstructure.WeakDecode still populates the c.Replacements slice on the struct, that slice is never converted into c.replacementsMap entries, and imp.pathProjectReplaced can no longer be triggered by a theme. The fix completely neutralizes this code path.
Exploiting GHSA-r73q-gwx2-fpxm requires a developer or automated CI/CD pipeline to run a Hugo site build (hugo or hugo server) using an untrusted or compromised theme when the top-level project configuration does not declare its own module.replacements. No special command-line flags or elevated OS privileges are required.
To construct an exploit payload, the attacker creates a theme configuration file (themes/mytheme/hugo.toml) that defines a synthetic module name in module.imports and redirects that name to a sensitive host directory using module.replacements. The theme then mounts the root of that replaced module (source = ".") into Hugo's assets virtual directory.
Consider the following directory hierarchy and configuration files based on the upstream regression test:
# Root project configuration: hugo.toml
disableKinds = ["taxonomy", "term", "rss"]
theme = "mytheme"# Malicious theme configuration: themes/mytheme/hugo.toml
[module]
replacements = "evil -> ../../secret"
[[module.imports]]
path = "evil"
[[module.imports.mounts]]
source = "."
target = "assets"When the victim runs hugo, the following execution sequence occurs:
hugo.toml. Because no [module] replacements exist, c.moduleConfig.replacementsMap remains nil.themes/mytheme/hugo.toml via applyThemeConfig. The replacements = "evil -> ../../secret" directive is parsed and applied to the evil module import, setting pathProjectReplaced = true.createThemeDirname resolves ../../secret relative to themes/ (or an absolute path such as /etc), bypassing directory containment checks because isProjectMod is true.normalizeMounts), the mount source = "." passes filepath.IsLocal(".") validation because it is relative to the newly established module root (../../secret).assets virtual filesystem.Once mounted into assets, the attacker can exfiltrate file contents through two primary mechanisms. First, Hugo templates within the theme can invoke resources.Get or resources.Match to read arbitrary files from the mounted directory and embed their contents straight into the generated HTML output inside public/.
Second, mounting a host directory into assets alters Hugo's Node.js security boundary. Hugo populates the --allow-fs-read flag for Node.js subprocesses (security.node.permissions) using all active assets mount roots. By mounting an external directory into assets, the attacker expands the Node.js filesystem sandbox to include that host directory, enabling asset pipeline plugins (such as css.PostCSS) to read sensitive host files or load and execute arbitrary JavaScript modules residing in the mounted path.
The primary security impact of GHSA-r73q-gwx2-fpxm is high confidentiality loss on the system executing the Hugo build (VC:H under CVSS v4.0), accompanied by a sandbox escape in environments leveraging Node.js asset pipelines. The official CVSS v4.0 vector is 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, resulting in a base score of 6.8 (Medium).
In a typical exploitation scenario targeting an automated deployment pipeline (such as GitHub Actions, GitLab CI, or Netlify), a malicious theme update or pull request can mount sensitive directories from the build runner—such as /etc, /proc/self/environ, ~/.aws, or ~/.ssh—into the Hugo assets directory. The theme's layout templates can then read these files via resources.Get and render the extracted secrets directly into the publicly deployed static website.
For local developer workstations, running hugo or hugo server on a project utilizing a malicious theme exposes any file readable by the user's OS account. Furthermore, if the project invokes Node-based asset processors like PostCSS or Tailwind CSS, expanding the --allow-fs-read boundary allows Node.js scripts to access files and import .js modules outside the project root, negating Hugo's built-in Node permission restrictions.
Integrity (VI:N) and Availability (VA:N) impacts are rated as None within the scope of Hugo's native virtual file system because hugofs mounts used for assets are read-only interfaces; Hugo does not write back to mounted assets source directories during site generation.
The definitive remediation for GHSA-r73q-gwx2-fpxm is to upgrade Hugo to version v0.168.0 or later. In v0.168.0, theme-level module.replacements directives are unconditionally ignored, and any attempt by a theme to import a virtual module name relying on theme-level replacement fails the build with module "<name>" not found.
# Upgrade Hugo using Go install
go install github.com/gohugoio/hugo@v0.168.0For environments where an immediate upgrade of the Hugo binary is not feasible, security engineers and site administrators can apply a configuration-level workaround that neutralizes the vulnerable code branch in decodeConfig. Because the vulnerability only triggers when the root project's c.moduleConfig.replacementsMap is nil, explicitly defining a dummy module.replacements entry in the root project's hugo.toml initializes replacementsMap and prevents Hugo from parsing replacements defined in child themes:
# Workaround in root project hugo.toml for Hugo >= 0.152.0, < 0.168.0
[module]
replacements = "_dummy_nonexistent_module -> _dummy_nonexistent_target"In addition to patching or applying the configuration workaround, teams should audit existing third-party themes and vendored modules in their repositories for unauthorized replacements directives:
# Search for module replacement directives across themes and vendored modules
grep -rn "replacements" themes/ _vendor/Finally, CI/CD pipelines building Hugo sites that incorporate third-party themes should run within isolated, ephemeral containers without host volume mounts or ambient cloud credential files on the filesystem.
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| Product | Affected Versions | Fixed Version |
|---|---|---|
Hugo gohugoio | >= 0.152.0, < 0.168.0 | 0.168.0 |
| Attribute | Detail |
|---|---|
| Advisory ID | GHSA-r73q-gwx2-fpxm |
| Weakness Class | CWE-22 (Path Traversal) / CWE-552 |
| CVSS v4.0 Score | 6.8 Medium (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 Vector | Local / Build-time via Untrusted Hugo Theme or Module |
| Affected Versions | >= 0.152.0, < 0.168.0 |
| Patched Version | v0.168.0 |
| Primary Impact | Arbitrary Host Directory Mount & Node.js Read Sandbox Escape |
| Exploit Status | Proof-of-Concept (Regression Test in Upstream Patch) |
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.
CVE-2026-135388 (GHSA-7c2r-jhm9-43vf) is an improper verification of cryptographic signature vulnerability (CWE-347) in Pion DTLS, a pure Go implementation of Datagram Transport Layer Security (RFC 6347). The vulnerability stems from signature scheme confusion and missing cryptographic parameter binding in the handshake verification functions verifyKeySignature and verifyCertificateVerify. By presenting a genuine peer certificate paired with an incompatible or digest-less signature hash algorithm on the wire, an unauthenticated network adversary can bypass signature verification without possessing the peer's private key. This allows peer impersonation and full compromise of confidentiality and integrity in DTLS-protected channels, including WebRTC sessions utilizing SDP certificate fingerprint verification.
CVE-2026-134024 is a Server-Side Request Forgery (SSRF) vulnerability (CWE-918) in the TastyIgniter open-source restaurant management platform prior to version 4.4.4. The flaw resides in the Media::addFromUrl() helper method within the tastyigniter/core package, which initiates outbound HTTP GET requests to caller-supplied URLs and persists the response body without validating the URI scheme, target hostname, or resolved IP address. Although unreachable in a default unextended installation, the method functions as a latent SSRF gadget that exposes the host environment to internal network reconnaissance and cloud metadata extraction when invoked by third-party extensions or custom application code.
CVE-2026-61832 is a compound vulnerability in NukeViet CMS versions prior to 4.6.00 resulting from disabled TLS certificate validation (CWE-295) in internal HTTP clients and unrestricted PHP deserialization (CWE-502) in administrative extension store handlers. An adversary-in-the-middle (AiTM) attacker can intercept outbound HTTPS connections to the NukeViet extension store API and inject a crafted serialized PHP object. When an administrator interacts with the extension store, the application deserializes the response, triggering an in-tree Property-Oriented Programming (POP) gadget chain in Guzzle to achieve arbitrary file write and remote code execution.
CVE-2026-69217 (also tracked as GHSA-p83c-4wj9-p6w9) is an HTTP request and response smuggling vulnerability in the ember-core module of the http4s Scala library. Prior to versions 0.23.35 and 1.0.0-M47, the HTTP/1.1 message parser failed to reject HTTP messages containing duplicate Content-Length header fields with conflicting values or sign-prefixed numeric values. Instead of returning a 400 Bad Request error as mandated by RFC 9112 Section 6.3, the parser accepted all occurrences sequentially and honored the final Content-Length value, while also permitting negative numbers via Scala's standard string-to-long conversion. When deployed behind a reverse proxy or intermediary that prioritizes the first Content-Length header or handles non-digit characters differently, unauthenticated remote attackers can desynchronize persistent HTTP/1.1 connections to perform web cache poisoning, bypass front-end security controls, and capture cross-user HTTP requests.
CVE-2026-65973 (GHSA-h746-qpxh-ph7g) is a local operating system command injection vulnerability (CWE-78) in the PeteBishwhip/laradocs package for Laravel. Versions from 0.4.0 to before 1.0.0 fail to sanitize or escape the configured Node.js binary path before passing it as part of a command string to PHP's proc_open() function during server-side KaTeX rendering. An attacker with the ability to modify local configuration files or environment variables can inject shell metacharacters to execute arbitrary OS commands under the privileges of the web server process.
A SQL injection vulnerability exists in power-components/livewire-powergrid versions 6.0.0 through 6.10.3. The public Livewire component property sortDirection is interpolated directly into raw SQL ORDER BY clauses during natural sorting operations without prior validation. By clearing the sortField property to bypass standard Laravel query builder protections, an attacker can inject arbitrary SQL expressions via POST requests to the /livewire/update endpoint.