CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-R48V-R4VW-H9V8

GHSA-r48v-r4vw-h9v8: Arbitrary Build-Host File Disclosure via Path Traversal in Hugo Vendored Module Metadata

Alon Barad
Alon Barad
Software Engineer

Dec 1, 2026·9 min read·5 visits

Executive Summary (TL;DR)

A path traversal and symlink following vulnerability in Hugo (< 0.170.0) allows malicious themes or modules to read arbitrary files from the build host filesystem via crafted `_vendor/modules.txt` metadata and symbolic links, exposing sensitive host data in the compiled website output.

Hugo versions prior to 0.170.0 contain a path traversal and improper symlink resolution vulnerability in the module resolution and vendoring subsystem. By supplying relative traversal sequences in `_vendor/modules.txt` or crafting symbolic links within vendored directory hierarchies, an untrusted third-party theme or Hugo module can bind its module root to an arbitrary directory on the build host. During site compilation, template functions such as `readFile` can access and render sensitive files from the host filesystem into the generated static output.

Vulnerability Overview

Hugo is an open-source static site generator written in Go (github.com/gohugoio/hugo). To support modular site architectures, Hugo includes a module system built on top of Go Modules that enables projects to import external themes, layout components, data files, and static assets. For reproducible and offline builds, Hugo supports dependency vendoring, where module contents are stored in a _vendor directory and mapped via a _vendor/modules.txt metadata file.

In versions prior to 0.170.0, Hugo failed to properly validate module import paths and directory structures when resolving vendored dependencies and theme paths. Specifically, the module collector did not restrict module paths specified in _vendor/modules.txt to local relative paths, nor did it verify whether intermediate directories within a non-project module's hierarchy were symbolic links pointing outside the module's boundary.

This flaw is classified under CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and CWE-59 (Improper Link Resolution Before File Access). Because Hugo binds the resolved module root into its virtual union filesystem (hugofs), any directory targeted by the traversal or symlink becomes accessible to the template rendering engine.

When a developer or an automated CI/CD pipeline builds a Hugo site containing a malicious theme or module, templates within that module can invoke filesystem access functions such as readFile. The contents of arbitrary readable files on the build host are subsequently embedded directly into the compiled static output directory (public/), resulting in unauthorized information disclosure (CWE-200).

Root Cause Analysis

The vulnerability originates from three distinct validation weaknesses within Hugo's modules package (modules/collect.go and modules/client.go). When Hugo initializes a site build, the collector struct parses module configurations (module.imports) and inspects _vendor/modules.txt files across the project and its imported dependencies.

The first flaw resided in (*collector).collectModulesTXT within modules/collect.go. When parsing _vendor/modules.txt, Hugo splits lines matching module header declarations using strings.Fields(line) and extracts the module path from parts[0]. Prior to the patch, Hugo accepted parts[0] verbatim without checking if the string contained relative path traversal sequences (..) or absolute path prefixes. When joined with the _vendor directory path, sequences such as ../../../.. escaped the _vendor directory and resolved to arbitrary ancestor directories on the host filesystem.

The second flaw involved insufficient symbolic link validation in (*collector).getAndCreateModule. Even when a module path in hugo.toml and _vendor/modules.txt appeared syntactically local (for example, github.com/foo/bar), an attacker could place a symbolic link inside the theme's _vendor directory or at an intermediate path component (such as _vendor/github.com/foo/bar -> /etc). Hugo did not inspect non-project owner directories to ensure that resolved module directories were free of symlinks prior to mounting them.

The third flaw occurred in (*Client).createThemeDirname inside modules/client.go. The function joined the base themes directory with modulePath (moduleDir := filepath.Join(c.ccfg.ThemesDir, modulePath)) and validated the result for non-project modules using a basic string prefix check: !strings.HasPrefix(moduleDir, c.ccfg.ThemesDir). String prefix checks on cleaned file paths are brittle; if c.ccfg.ThemesDir lacked a trailing separator, a sibling directory sharing the same prefix could bypass validation, and filepath.IsLocal was not enforced directly on the input modulePath.

Code Analysis

Maintainer Bjørn Erik Pedersen resolved the vulnerability in commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0 (Pull Request #15564). The fix enforces Go's standard library filepath.IsLocal check on untrusted module paths and introduces recursive symlink verification between a module directory and its owner root.

In modules/collect.go, collectModulesTXT was updated to validate path immediately after token extraction. The filepath.IsLocal function (introduced in Go 1.20) ensures that the path is strictly relative, does not empty out, does not begin with a root separator or Windows volume name, and does not escape the starting directory via .. components.

// File: modules/collect.go
func (c *collector) collectModulesTXT(owner Module) error {
	// ... [lines omitted] ...
		path := parts[0]
 
		// FIX: Verify that the module path extracted from modules.txt is strictly local.
		// Rejects any path containing ".." traversal sequences or absolute paths.
		if !filepath.IsLocal(path) {
			return fmt.Errorf("invalid module path %q in %q: must be a local path relative to %q", path, filename, vendord)
		}
 
		shouldAdd := c.Client.moduleConfig.VendorClosest

To prevent symlink escapes within third-party modules, the patch added checkNoSymlinksInOwnerDir in modules/collect.go and invoked it from getAndCreateModule whenever !moduleImport.pathProjectReplaced is true. This function skips the root project module (ma.projectMod), computes the relative path between the owner module's root directory and the target moduleDir, and delegates symlink detection to hugofs.IsSymlinkOrHasSymlinkParent.

// File: modules/collect.go
func (c *collector) getAndCreateModule(owner *moduleAdapter, moduleImport Import, vendor bool) (*moduleAdapter, error) {
	// ... [lines omitted] ...
	// FIX: Ensure non-project modules cannot use symlinks inside their directory tree
	if !moduleImport.pathProjectReplaced {
		if err := c.checkNoSymlinksInOwnerDir(realOwner, moduleDir); err != nil {
			return nil, err
		}
	}
 
	if !strings.HasSuffix(moduleDir, fileSeparator) {
		moduleDir += fileSeparator
	}
	// ... [lines omitted] ...
}
 
func (c *collector) checkNoSymlinksInOwnerDir(owner Module, moduleDir string) error {
	if ma, ok := owner.(*moduleAdapter); !ok || ma.projectMod {
		return nil
	}
	ownerDir := filepath.Clean(owner.Dir())
	moduleDir = filepath.Clean(moduleDir)
	rel, err := filepath.Rel(ownerDir, moduleDir)
	if err != nil || rel == "." || !filepath.IsLocal(rel) {
		return nil
	}
	// Walk from moduleDir up to ownerDir checking every path segment for symlinks
	symlink, err := hugofs.IsSymlinkOrHasSymlinkParent(c.fs, ownerDir, moduleDir)
	if err != nil {
		return err
	}
	if symlink {
		return fmt.Errorf("invalid module dir %q in %q: symlinks are not allowed", rel, owner.Path())
	}
	return nil
}

In hugofs/nosymlinks_fs.go and modules/client.go, the filesystem helper was exposed and createThemeDirname was updated to replace the prefix check with !filepath.IsLocal(modulePath).

// File: modules/client.go
func (c *Client) createThemeDirname(modulePath string, isProjectMod bool) (string, error) {
	modulePath = filepath.Clean(modulePath)
	if modulePath == "" || modulePath == "." {
		return "", invalid
	}
 
	// FIX: Replace strings.HasPrefix check with strict filepath.IsLocal verification
	if !isProjectMod && !filepath.IsLocal(modulePath) {
		return "", invalid
	}
	return filepath.Join(c.ccfg.ThemesDir, modulePath), nil
}

> [!NOTE] > Fix Completeness Assessment: The combination of filepath.IsLocal on metadata path strings and recursive parent symlink checking via hugofs.IsSymlinkOrHasSymlinkParent effectively closes both lexical path traversal and filesystem-level symlink redirection within third-party modules. Because checkNoSymlinksInOwnerDir evaluates every directory component between ownerDir and moduleDir, both direct symlinks and intermediate parent directory symlinks are blocked.

Exploitation

Exploitation requires a victim user or automated build runner to compile a Hugo site that imports an attacker-controlled theme or module. No special privileges or runtime flags are required beyond running the standard hugo build command. The regression tests added in commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0 demonstrate two primary exploitation techniques.

Technique 1: Lexical Path Traversal via _vendor/modules.txt

In this scenario, an attacker publishes a malicious theme (themes/evil) containing a vendored module definition that uses .. sequences to traverse up to the build host's root or working directory.

  1. The target project references the theme in its main hugo.toml:
theme = "evil"
  1. The malicious theme declares a traversed module import in themes/evil/hugo.toml:
[[module.imports]]
path = "../../../.."
  1. The malicious theme includes a corresponding entry in themes/evil/_vendor/modules.txt:
# ../../../.. v0.0.0
  1. A layout file included in the build (such as layouts/home.html) invokes readFile relative to the traversed root:
SECRET: {{ readFile "secret/passwd.txt" }}

When an unpatched version of Hugo (< 0.170.0) runs, it resolves themes/evil/_vendor/../../../.. to the ancestor directory on the host, mounts it into the module workspace, reads secret/passwd.txt, and outputs the file contents into public/index.html.

Technique 2: Symlink Redirection in Vendored Directories

Instead of using .. in _vendor/modules.txt, the attacker creates a valid-looking module path (github.com/foo/bar) inside themes/evil/hugo.toml and themes/evil/_vendor/modules.txt, which passes lexical path checks.

mkdir -p themes/evil/_vendor/github.com/foo
ln -s /etc themes/evil/_vendor/github.com/foo/bar

Because git repositories preserve symbolic links when cloned, any user or CI runner cloning the theme repository receives the symlink pointing to /etc (or another target path on the host). On unpatched Hugo versions, the collector follows the symlink without raising an error, mounting /etc as the module directory and allowing template functions to read files such as /etc/passwd.

Impact Assessment

The primary impact of GHSA-r48v-r4vw-h9v8 is high-severity confidentiality loss on the system executing the Hugo build (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N, Base Score 5.5). While the attack does not enable arbitrary code execution or file modification on the host (I:N/A:N), it grants full read access to any file readable by the user account running the hugo binary.

In local development environments, a developer testing a third-party Hugo theme from an untrusted source can have local files—such as ~/.ssh/id_rsa, ~/.aws/credentials, .env files, or git credentials—read during hugo or hugo server execution. If the developer subsequently commits or deploys the generated public/ directory, those secrets are published online.

In automated CI/CD and static site hosting platforms (such as GitHub Actions, GitLab CI, Netlify, or Vercel), the risk profile increases significantly. Automated build pipelines regularly clone repository dependencies and immediately publish the output of public/ to publicly accessible Content Delivery Networks (CDNs).

An attacker who compromises an upstream Hugo theme or submits a pull request modifying _vendor/modules.txt can exfiltrate CI runner environment files (such as /proc/self/environ on Linux runners), cloud instance metadata tokens cached on disk, or temporary build credentials directly to the public deployment preview URL.

Remediation

Users, site administrators, and CI/CD platform operators should upgrade Hugo to version 0.170.0 or later immediately. Version 0.170.0 incorporates commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0, which aborts the build process if _vendor/modules.txt or modulePath contains non-local paths or if non-project modules contain symbolic links in their module directory hierarchy.

To upgrade Hugo using the Go toolchain or package managers:

# Using Go toolchain
go install -tags extended github.com/gohugoio/hugo@v0.170.0
 
# Using Homebrew
brew update && brew upgrade hugo

For environments where an immediate binary upgrade is not feasible, security teams should implement pre-build verification checks in their CI/CD pipelines before executing hugo. First, scan all _vendor/modules.txt and hugo.toml / config.toml files in imported themes for relative path traversal sequences or leading slashes:

grep -rnE "(\.\.|^\s*#\s*/)" _vendor/ themes/ || true

Second, scan the themes/ and _vendor/ directories for any symbolic links prior to building the site, and fail the pipeline if unexpected symlinks are present:

find themes/ _vendor/ -type l -ls

Finally, ensure that automated Hugo builds run inside isolated, unprivileged containers with minimal host volume mounts and without sensitive deployment credentials written to the container filesystem during the static build stage.

Official Patches

Hugo (gohugoio)Official GitHub Security Advisory for GHSA-r48v-r4vw-h9v8
Hugo (gohugoio)Security Patch Commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0
Hugo (gohugoio)Hugo v0.170.0 Release Notes

Fix Analysis (1)

Technical Appendix

CVSS Score
5.5/ 10
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Affected Systems

Hugo Static Site Generator (< 0.170.0)

Affected Versions Detail

Product
Affected Versions
Fixed Version
Hugo
gohugoio
< 0.170.00.170.0
AttributeDetail
Advisory IDGHSA-r48v-r4vw-h9v8
Weakness ClassCWE-22 (Path Traversal) / CWE-59 (Link Following)
Attack VectorLocal / Supply Chain (Malicious Hugo Theme or Module)
CVSS v3.1 Score5.5 Medium (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N)
ImpactArbitrary Build-Host File Disclosure
Affected VersionsHugo < 0.170.0
Patched VersionHugo >= 0.170.0
Exploit StatusPoC Available (Regression Test Suite)

MITRE ATT&CK Mapping

T1195.002Supply Chain Compromise: Compromise Software Dependencies and Development Tools
Initial Access
T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
T1552Unsecured Credentials
Credential Access
T1567Exfiltration Over Web Service
Exfiltration
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software 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 software 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.

Known Exploits & Detection

GitHub (Hugo Regression Test Suite)Official regression tests included in the fix commit demonstrating path traversal via _vendor/modules.txt and symlink directory traversal to read host files via readFile.

Vulnerability Timeline

Fix commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0 merged via Pull Request #15564 and released in Hugo v0.170.0
2025-04-16

References & Sources

  • [1]GitHub Advisory Database: GHSA-r48v-r4vw-h9v8
  • [2]Hugo Repository Security Advisory: GHSA-r48v-r4vw-h9v8
  • [3]Fix Commit d41a8a196e6b2fd5e5aa886c790d6c679dd73be0
  • [4]Hugo Pull Request #15564
  • [5]Hugo Release v0.170.0

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-137191
7.8

CVE-2026-137191: Arbitrary Code Execution via Unverified Package Manager Bootstrap in Vite+ (vp)

Vite+ (vp) versions 0.2.9 through 1.5.0 contain an integrity verification flaw (CWE-494) in the internal package manager bootstrap mechanism. When initializing in an environment where the pinned pnpm distribution is not cached, the runtime queries the registry specified in the local workspace's .npmrc file and validates the downloaded tarball exclusively against the self-reported integrity digest provided by that same registry. An attacker who supplies a repository with a malicious .npmrc pointing to an attacker-controlled registry can achieve arbitrary code execution when a developer or CI runner invokes basic vp commands.

Alon Barad
Alon Barad
1 views•9 min read
•about 2 hours ago•CVE-2026-137190
7.0

CVE-2026-137190: Shell Command Injection in Vite+ Global CLI via Unvalidated Registry Version String

A local OS command injection and dynamic code evaluation vulnerability (CWE-78 / CWE-95) exists in the Vite+ global command-line interface (vp) across versions 0.3.3 through 1.5.0. When resolving package manager dist-tags such as 'latest' with the '--no-install' flag enabled, Vite+ queries the npm registry defined in the local workspace's '.npmrc' file and returns the raw version string without semantic version validation. Because this unvalidated string is interpolated directly into shell environment export statements evaluated by the user's shell wrapper, an attacker controlling the registry can inject shell metacharacters to achieve arbitrary command execution in the developer's local terminal context.

Alon Barad
Alon Barad
4 views•10 min read
•about 3 hours ago•CVE-2026-137196
6.3

CVE-2026-137196: Synchronous Event-Loop Denial of Service via Unbounded Ignore Pattern Expansion in node-glob

CVE-2026-137196 (also tracked as GHSA-qxr8-q827-836c) is an asymmetric resource consumption and denial-of-service vulnerability affecting the npm package glob (node-glob) in versions 13.0.5 through 14.0.5. When processing primary search patterns, node-glob relies on the minimatch engine with a default safeguard parameter (braceExpandMax: 10_000) to prevent combinatorial explosions during shell brace and directory traversal expansion. However, the Ignore class in src/ignore.ts instantiated its internal minimatch options with optimizationLevel: 2 while omitting the braceExpandMax configuration property. Consequently, applications that pass untrusted input into the ignore option allow attackers to trigger unbounded pattern expansion and quadratic O(n^2) preprocessing loops inside secondPhasePreProcess(), leading to single-threaded Node.js event-loop starvation.

Alon Barad
Alon Barad
6 views•10 min read
•about 5 hours ago•GHSA-4WHP-JX7J-XVRM
5.1

GHSA-4whp-jx7j-xvrm: Stored Cross-Site Scripting in Hugo Syntax Highlighter via wrapperClass

A stored Cross-Site Scripting (XSS) vulnerability in the Hugo static site generator (versions 0.140.2 prior to 0.170.0) allows content authors to inject arbitrary HTML and JavaScript into generated pages. The flaw resides in the syntax highlighting component (`markup/highlight/highlight.go`), where the `wrapperClass` option is concatenated directly into an HTML `<div class="...">` attribute without HTML entity escaping. Because shortcodes and code fence attributes bypass Goldmark's raw HTML sanitization rules, untrusted contributors in multi-author workflows can achieve client-side script execution in the browsers of site visitors.

Alon Barad
Alon Barad
4 views•9 min read
•about 7 hours ago•CVE-2026-139994
4.7

CVE-2026-139994: Cross-Site Scripting via Context-Mismatched HTML Escaping in React Router RSC Streaming Redirects

CVE-2026-139994 (GHSA-mjj8-rxh9-q8f5) is a Cross-Site Scripting (XSS) vulnerability in React Router affecting versions 7.11.0 through 7.18.3 and 8.0.0 through 8.3.1. The flaw resides in the server-side streaming handler for the unstable React Server Components (RSC) Data mode and RSC Framework mode. When a server-side redirect is triggered during an HTML stream, the framework injects an inline <meta http-equiv="refresh"> element into the response stream. Because the redirect destination URL is sanitized using an HTML body escaping utility (escapeHtml) rather than an attribute-specific encoding function, double-quote characters (") are left unescaped. An attacker who can influence the redirect URL can break out of the content attribute context, inject arbitrary attributes or HTML elements, and execute arbitrary JavaScript within the victim's browser session.

Alon Barad
Alon Barad
8 views•11 min read
•about 8 hours ago•CVE-2026-139996
7.4

CVE-2026-139996: Prototype Pollution in React Router via Vendored turbo-stream Deserializer

CVE-2026-139996 is a prototype pollution vulnerability (CWE-1321) in React Router's vendored turbo-stream deserializer, utilized in Framework mode for single-fetch transitions and client-server hydration. When unflattening serialized streams, the decoder assigns object properties using direct bracket notation (object[key] = value) rather than defining own properties via Object.defineProperty. Furthermore, the deserializer lacks integer and bounds validation on stream reference indices. An attacker capable of supplying crafted turbo-stream payloads to the deserializer can pollute Object.prototype or trigger arbitrary index dereferences, compromising application integrity and confidentiality.

Amit Schendel
Amit Schendel
6 views•9 min read