CVE-2026-140395: Hugo 0.56.0 before 0.170.0 Path Traversal via _vendor/modules.txt
Hugo from 0.56.0 before 0.170.0 contains a path traversal vulnerability that allows malicious themes or modules to read arbitrary build host files by supplying '..' segments in vendor/modules.txt import paths. Attackers can make Hugo treat any directory as a module root and use readFile or static mounts to publish secrets, credentials, and system files in the generated site.
Affected Software
Event History
Frequently Asked Questions
Which Hugo deployments are realistically exposed?
Deployments using Hugo versions from 0.56.0 through versions before 0.170.0 are exposed when they build a malicious theme or module containing crafted import paths in _vendor/modules.txt. The vulnerable build host is the system at risk, not only the generated site.
What does an attacker need to exploit this issue?
An attacker needs to cause Hugo to process a malicious theme or module that supplies '..' path segments in _vendor/modules.txt import paths. No authentication, user interaction, or complex attack conditions are indicated.
What can a successful exploit expose?
The crafted import paths can cause Hugo to treat arbitrary directories as module roots. The malicious content can then use readFile or static mounts to include secrets, credentials, or system files from the build host in the generated site.
What should be done if this affects a build pipeline?
Upgrade Hugo to version 0.170.0 or later. Until then, do not build untrusted themes or modules, and treat generated output from affected builds as potentially containing files from the build host.