CVE-2026-58404: Hugo SSRF Bypass via Alternative IP Encodings
Hugo, a popular static site generator, contains a security bypass in versions 0.162.0 through 0.163.0. The issue stems from incomplete validation of IP address formats in Hugo's security policy for remote requests. While the security policy correctly blocks requests to loopback addresses (127.0.0.1) and cloud metadata endpoints, attackers can circumvent this protection by encoding IP addresses in alternative formats—such as integers, hexadecimal, or octal notation—that the validator doesn't recognize. This allows malicious templates to make unauthorized requests to local services during the build process, potentially exposing sensitive data from cloud metadata services in CI/CD environments. The vulnerability is resolved in version 0.163.1.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 6.8 MEDIUM · CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N
- Weaknesses (CWE)
- CWE-918
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-06 / 2026-07-08
NVD description (verbatim)
Hugo is a static site generator. From v0.162.0 through v0.163.0, the default security.http.urls policy denies requests to loopback, internal, and cloud-metadata IPv4 literals, but the deny rule only matched dotted-decimal notation, so alternate IPv4 encodings of the same addresses, including integer, hex, or octal, passed the policy. When a template passes an untrusted or data-derived URL to resources.GetRemote and the host platform uses the cgo system resolver, these encodings resolve to the blocked address, allowing build-time server-side requests to loopback and internal services, including the cloud-metadata endpoint in hosted or CI builds; the same check is reused on redirects, so the gap also applies to each redirect hop. This issue is fixed in v0.163.1.
4 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
Hugo's default security.http.urls policy enforces server-side request forgery (SSRF) protections by denying HTTP requests to loopback addresses (127.0.0.0/8), internal RFC1918 ranges, and cloud-metadata endpoints. However, the deny rule performs a string-based match only against dotted-decimal IPv4 notation (e.g., 127.0.0.1). Alternate representations—integer format (2130706433), hexadecimal (0x7f000001), and octal (0177.0.0.1)—bypass the filter. When resources.GetRemote processes a template URL with an alternative-encoded IP literal and the host resolver uses cgo (typical on most Unix systems), the OS resolver translates the non-standard encoding to the canonical address, which then connects to the blocked service. The same validation gap affects HTTP redirect chains, permitting attackers to bypass the policy on each hop. This affects Hugo builds where untrusted or data-derived content flows into template functions that perform remote fetches.
Business impact
In hosted and CI/CD environments, this vulnerability permits unauthorized access to cloud-metadata services during static site builds. An attacker who can inject malicious template content—through frontmatter processing, data files, or dynamic template generation—can exfiltrate credentials, API tokens, or role metadata. In corporate deployments, this compounds the risk if Hugo builds run with elevated cloud IAM permissions. For open-source projects accepting community templates or using third-party themes without strict sandboxing, the attack surface expands. The confidentiality impact is rated high because metadata endpoints often leak sensitive operational secrets; however, direct system compromise or data manipulation is not feasible through this vector alone.
Affected systems
Hugo versions 0.162.0 through 0.163.0 are affected. Any deployment that (1) processes user-supplied or untrusted template content, (2) runs in an environment with accessible loopback or cloud-metadata services (AWS IMDSv2, Google Compute Engine metadata, Azure IMDS), and (3) relies on the cgo system resolver is at risk. Self-hosted environments with strict network isolation and containerized builds without metadata endpoint access face lower risk. Upgrade to version 0.163.1 or later to remediate.
Exploitability
Exploitation requires the ability to inject or modify template content within a Hugo build context. This is most practical in scenarios where Hugo processes untrusted frontmatter, data files from external sources, or dynamically generated templates. The attacker must craft a URL using an alternative IP encoding (e.g., resources.GetRemote("http://2130706433/")). No special privileges or user interaction are required at runtime; the attack occurs during the build phase. The CVSS vector indicates authentication is required (PR:L), reflecting the assumption that template modification requires at least contributor-level access. However, in open-source projects or workflows accepting pull requests, this barrier may be low. The attack is reliable and not probabilistic.
Remediation
Upgrade Hugo to version 0.163.1 or later immediately. This release fixes the security.http.urls policy to recognize and reject alternate IPv4 encodings. For organizations unable to patch immediately, implement compensating controls: (1) restrict Hugo build environments to networks without access to metadata endpoints, (2) disable or revoke cloud IAM credentials from build runners, (3) enforce code review workflows to prevent malicious template injection, and (4) consider using Hugo's sandboxing features if available or running builds in isolated containers. Do not rely solely on WAF or firewall rules, as the attack occurs at build time, not runtime.
Patch guidance
Apply Hugo version 0.163.1 or later. Verify the update by running `hugo version` and confirming the patch version. Review your theme and plugin dependencies to ensure they are also compatible with 0.163.1. If using a package manager (Homebrew, apt, etc.), update through the standard channel. For Docker-based workflows, rebuild images with the patched Hugo binary. No configuration changes or theme modifications are required post-patch. Existing projects should redeploy their site with the patched version to clear any cached artifacts.
Detection guidance
Monitor Hugo build logs for unexpected outbound requests to loopback addresses (127.x.x.x, ::1), private ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), or cloud-metadata endpoints (169.254.169.254, metadata.google.internal, etc.). Set network egress policies to alert on such requests from CI/CD runners. Audit frontmatter and data file sources to identify any suspicious template injection. Implement strict Content Security Policy rules in resulting static sites to limit downstream exploitation. Correlate Hugo build execution times with unexpected network activity. For teams using threat intelligence integrations, watch for templates or themes that reference IP encodings in resources.GetRemote calls.
Why prioritize this
This vulnerability should be prioritized for any Hugo deployment in cloud environments or CI/CD pipelines. The CVSS score of 6.8 (Medium) reflects high confidentiality risk with limited user interaction and authentication barriers in open-source contexts. The attack is practical and does not require exploit code—only a malicious template—making it actionable for adversaries with template-modification access. Cloud-native setups are at heightened risk because metadata endpoints leak high-value secrets. The lack of current KEV status does not diminish the threat; active exploitation in the wild is plausible given the simplicity of the bypass.
Risk score, explained
The CVSS 3.1 score of 6.8 reflects: (1) Network-accessible attack vector (AV:N) because Hugo builds may run in cloud or hosted environments, (2) Low attack complexity (AC:L) because crafting an alternative IP encoding is trivial, (3) Low privileges required (PR:L) in open-source or pull-request workflows where contributors can modify templates, (4) User interaction required (UI:R) because a maintainer must execute the build with the malicious template, (5) Changed scope (S:C) because the attack crosses from the build system into cloud infrastructure, (6) High confidentiality impact (C:H) due to metadata exfiltration, and (7) no integrity or availability impact (I:N, A:N). The score appropriately reflects a serious confidentiality risk without direct system compromise.
Frequently asked questions
Can this vulnerability be exploited if Hugo runs in an isolated container without network access to metadata endpoints?
No. The vulnerability requires network access from the Hugo build environment to the blocked service. If your build container has no egress to loopback, internal networks, or cloud-metadata endpoints—enforced by firewall rules or network policies—the attack cannot succeed. However, this defense is only effective if strictly enforced; it should not be the sole mitigation.
Does this affect static sites already published by Hugo, or only the build process?
Only the build process is affected. Attackers cannot exploit this vulnerability through published HTML or assets. The attack occurs when Hugo processes a malicious template during build time and makes unauthorized requests to internal services. Once the site is published, it is not vulnerable to this issue.
What if I use Hugo in a GitHub Actions workflow or similar CI/CD service?
If your workflow has access to cloud metadata or ambient credentials (e.g., OIDC tokens, role credentials), or if your runner can reach internal services, you are at risk. Ensure your workflow's IAM role has minimal permissions, restrict network egress to only necessary endpoints, and keep Hugo updated. Many CI/CD platforms now offer network-isolation features; consult your provider's documentation.
How does the alternative IP encoding bypass work technically?
Hugo's security policy matches IP addresses as strings in dotted-decimal form (e.g., '127.0.0.1'). Alternative encodings like '2130706433' (decimal integer) or '0x7f000001' (hex) do not match the filter string. However, when the underlying system resolver (libc via cgo) processes these URLs, it interprets them as equivalent IP addresses and resolves them to the same blocked address, allowing the connection. The validator checked the format, not the semantic result.
This analysis is based on the official CVE record and Hugo security advisories. CVSS scores and severity ratings reflect standard vulnerability assessment frameworks and should be contextualized with your organization's threat model and asset criticality. Verify all patch versions and availability against the official Hugo release notes before deployment. The vulnerability requires template-injection access; organizations with strict code-review workflows and air-gapped build environments face lower risk. This information is provided for educational and defensive purposes only; unauthorized access to computer systems is illegal. Contact SEC.co or Hugo maintainers for additional technical clarification. Source: NVD (public-domain), retrieved 2026-08-15. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-50134MEDIUMHugo Security Policy Bypass via HTTP Redirect
- CVE-2025-36324MEDIUMIBM watsonx.data Intelligence SSRF Vulnerability - Patch & Detection Guide
- CVE-2025-58175MEDIUMGeoServer SSRF Vulnerability in Proxy Configuration
- CVE-2026-0285MEDIUMPAN-OS Server-Side Request Forgery (SSRF) – Palo Alto Networks
- CVE-2026-10052MEDIUMQuay SSRF in LDAP/SMTP Validation—Internal Network Reconnaissance Risk
- CVE-2026-10177MEDIUMSSRF in Aider-AI Aider 0.86.3 AWS Metadata Endpoint
- CVE-2026-10239MEDIUMJeecgBoot Server-Side Request Forgery (SSRF) in Word Editing Module
- CVE-2026-10240MEDIUMJeecgBoot SSRF Vulnerability in /airag/airagModel/test Endpoint