REDHAT-BUG-2541910: Medium severity Hugo Hugo vulnerability
Hugo is a static site generator. In versions after v0.123.0 and before v0.166.0, Hugo's symlink confinement checks stopped at the mount root itself, so a theme or module checked into themes/ (or a vendored module) could contain a symlink at a mount root (for example themes/mytheme/assets -> /some/dir/outside). Files behind such a symlink were readable during a site build through resources.Get, resources.Match and similar functions, and could be published to public/ via static mounts, bypassing the rule that theme and module mount sources must be local paths. Modules fetched via Go modules are not affected because Go module zips cannot contain symlinks, and this is not an escalation for the main project, which may already mount absolute paths by configuration. Fixed in v0.166.0, where symlinked mount roots and symlinked directories between the mount root and the module directory are treated as non-existent for all modules. As a workaround, inspect themes/ and vendored modules for symlinks at mount roots before building, or replace symlinks with explicit mounts.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in v0.166.0 - Compensating control
Before building, inspect themes/ and vendored modules for symlinks at mount roots; replace any such symlinks with explicit mounts.
Event History
Frequently Asked Questions
Which Hugo deployments are realistically exposed?
Builds using Hugo versions after v0.123.0 and before v0.166.0 are exposed when a checked-in theme under themes/ or a vendored module contains a symlink at a mount root. Go modules fetched through the Go module mechanism are not affected because Go module zip files cannot contain symlinks.
What access or content does an attacker need to exploit this?
An attacker would need to cause a theme or vendored module used by the build to contain a symlink at a mount root that points outside the intended directory. During the build, Hugo resource functions such as resources.Get and resources.Match could then read files behind that symlink, and static mounts could publish those files to public/.
Are main-project mounts affected in the same way?
This is not considered an escalation for the main project, because the main project may already mount absolute paths through its configuration. The issue concerns confinement of theme and module mount sources that are expected to be local paths.
What can be done if upgrading is not immediately possible?
Inspect themes/ and vendored modules for symlinks at mount roots before building. Replace any such symlinks with explicit mounts; the fixed behavior in v0.166.0 treats symlinked mount roots and symlinked directories between a mount root and its module directory as non-existent.