CVE-2026-50135: Hugo Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-fw87-fv5r-9fpw
CWE-59
Published
Advisory Summary

CVE-2026-50135 is a MODERATE remote code execution vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting Hugo libraries in the Go ecosystem. The issue involves symlink confinement bypass in resources.get. Remediation is available by upgrading affected packages to version 0.162.0.

CVE-2026-50135 at a Glance

CVE Identifier CVE-2026-50135
GHSA Identifier GHSA-fw87-fv5r-9fpw
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-59: Improper Link Resolution Before File Access ('Link Following')
Affected Product Hugo
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-50135

To remediate this vulnerability, upgrade all affected Hugo dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gohugoio/hugo fixed: 0.162.0
Upgrade github.com/gohugoio/hugo to 0.162.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gohugoio/hugo

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-50135, inspect your project dependencies for Hugo:

inspect dependencies for github.com/gohugoio/hugo

Analyze the terminal output to locate any version of Hugo in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.162.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. In Hugo, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

**Commit:** [f8b5fa09a6](https://github.com/gohugoio/hugo/commit/f8b5fa09a6) — _Fix prevention of direct symlink reads in resources.Get_ **Affected versions:** v0.123.0 through v0.161.1. Earlier versions are not affected. **Fixed in:** v0.162.0. **Severity:** Medium. Requires the attacker to be able to place (or convince a site author to place) a symlink inside a mounted directory — for example, inside a locally-vendored theme under `themes/`. Themes mounted as Go modules from GitHub have symlinks stripped on download and are not affected. Multi-directory walks (e.g. content/asset walking) were not affected either; only direct lookups via `resources.Get` followed symlinks. **Description.** Hugo's virtual filesystem is designed so that files under a mount cannot reach outside the mount tree. A regression introduced in v0.123.0 caused `RootMappingFs.statRoot` to call `Stat` (which follows symlinks) instead of `Lstat`, so a direct `resources.Get "somefile"` where `somefile` was a symlink pointing outside the mount would return the target's contents. This effectively let a symlink planted inside a theme or local mount read arbitrary files reachable to the user running `hugo`. **Mitigation.** v0.162.0 calls `LstatIfPossible` and rejects symlinked entries with `os.ErrNotExist`, matching the behaviour of pre-v0.123.0 releases and of the directory-walking code paths.

CVE-2026-50135 Affected Hugo Versions

1 component(s)
Fixed Versions:
0.162.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gohugoio/hugo
Go
≥ 0.123.0
< 0.162.0
0.162.0

References

Frequently Asked Questions

What is CVE-2026-50135?
CVE-2026-50135 is a security vulnerability in Hugo involving Symlink confinement bypass in resources.Get under CWE-59: Improper Link Resolution Before File Access ('Link Following').
Which Hugo versions are affected?
Affected versions include releases prior to 0.162.0 across affected packages: github.com/gohugoio/hugo.
What version fixes CVE-2026-50135?
Upgrading to 0.162.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gohugoio/hugo affected?
Yes, github.com/gohugoio/hugo is affected in releases prior to 0.162.0. Upgrade your dependency to 0.162.0 or later.
What CWE is associated with CVE-2026-50135?
CVE-2026-50135 is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following') (The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.).
How can I check Go dependencies for CVE-2026-50135?
Run the dependency tree command: 'inspect dependencies for github.com/gohugoio/hugo'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fw87-fv5r-9fpw",
  "modified" : "2026-06-16T20:12:34Z",
  "published" : "2026-06-16T20:12:34Z",
  "aliases" : [ "CVE-2026-50135" ],
  "summary" : "Hugo: Symlink confinement bypass in resources.Get",
  "details" : "**Commit:** [f8b5fa09a6](https://github.com/gohugoio/hugo/commit/f8b5fa09a6) — _Fix prevention of direct symlink reads in resources.Get_\n**Affected versions:** v0.123.0 through v0.161.1. Earlier versions are not affected.\n**Fixed in:** v0.162.0.\n**Severity:** Medium. Requires the attacker to be able to place (or convince a site author to place) a symlink inside a mounted directory — for example, inside a locally-vendored theme under `themes/`. Themes mounted as Go modules from GitHub have symlinks stripped on download and are not affected. Multi-directory walks (e.g. content/asset walking) were not affected either; only direct lookups via `resources.Get` followed symlinks.\n\n**Description.** Hugo's virtual filesystem is designed so that files under a mount cannot reach outside the mount tree. A regression introduced in v0.123.0 caused `RootMappingFs.statRoot` to call `Stat` (which follows symlinks) instead of `Lstat`, so a direct `resources.Get \"somefile\"` where `somefile` was a symlink pointing outside the mount would return the target's contents. This effectively let a symlink planted inside a theme or local mount read arbitrary files reachable to the user running `hugo`.\n\n**Mitigation.** v0.162.0 calls `LstatIfPossible` and rejects symlinked entries with `os.ErrNotExist`, matching the behaviour of pre-v0.123.0 releases and of the directory-walking code paths.",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gohugoio/hugo"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.123.0"
      }, {
        "fixed" : "0.162.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/gohugoio/hugo/security/advisories/GHSA-fw87-fv5r-9fpw"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gohugoio/hugo/commit/f8b5fa09a64950c32b803821ede411ebfe772b7a"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/gohugoio/hugo"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gohugoio/hugo/releases/tag/v0.162.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-59" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-16T20:12:34Z",
    "nvd_published_at" : null
  }
}