MEDIUM · CVSS 3.1 4.8 EPSS 0.4% · 22th percentile CWE-1286

CVE-2026-125109: Rack: Rack::Request#host_with_port (and #base_url / #url) return the raw invalid Host header - incomplete fix of CVE-2026-34835

Published 2026-11-10 · Updated 2026-11-10 · Also known as GHSA-2j8w-xcrc-x985

Summary

Rack's host-related methods incorrectly return raw, unvalidated authority strings when input fails validation, allowing for potential URL injection. Developers using Rack 3.0.x or 3.2.x should update to the patched versions immediately to ensure security-sensitive URLs are handled correctly.

Who is affected

Affected deployments are those using Rack 3.1 or 3.2 where absolute URLs, redirects, or host-dependent logic rely on host_with_port, base_url, or url methods without an explicit host allowlist. When an attacker provides a malformed Host or forwarded header, the application may generate malicious URLs containing unexpected characters like @, /, or ?, leading to potential redirection or information injection vulnerabilities.

Exploitability

The vulnerability is rated as Medium with a CVSS 3.1 base score of 4.8, reflecting an attack that requires a high degree of complexity and no direct authentication. While the EPSS score of 0.002 indicates a low probability of exploitation, the vulnerability is not currently listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-19. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
RubyGems rack >= 3.0.0, < 3.1.23 3.1.23 bundle update rack
RubyGems rack >= 3.2.0, < 3.2.8 3.2.8 bundle update rack

CVSS 3.1 vector

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

Attack vectorNetwork
Attack complexityHigh
Privileges requiredNone
User interactionNone
ScopeUnchanged
ConfidentialityLow
IntegrityLow
AvailabilityNone

FAQ

Is Rails affected by this vulnerability?

No, Rails overrides the affected methods in Action Dispatch and is not expected to be impacted.

Why is this considered an incomplete fix?

A previous fix (CVE-2026-34835) addressed host and hostname methods, but left host_with_port, base_url, and url returning unvalidated raw strings.

What happens if I am using Rack 2.2?

Rack 2.2 is affected as it never received the initial mitigation, meaning it continues to return raw values for all host methods.

Original advisory description
## Summary `Rack::Request#host_with_port`, and therefore `#base_url` and `#url`, return the raw authority string when it fails validation. An attacker-controlled `Host`, `X-Forwarded-Host`, or `Forwarded: host=` value containing characters that are not permitted in an authority is embedded verbatim in URLs generated by the application. This completes the fix for CVE-2026-34835 (GHSA-g2pf-xv49-m2h5), which made `#host` and `#hostname` return `nil` for an invalid authority but left this path unchanged. ## Details `Rack::Request#host_with_port` splits the authority with `split_authority`. When the `AUTHORITY` pattern does not match, no components are returned and `host_with_port` falls back to returning the unvalidated authority string. `base_url` is `"#{scheme}://#{host_with_port}"` and `url` appends the full path, so both inherit the raw value. For a request with `Host: evil.com/@legit.com`, `host` returns `nil` while `host_with_port` returns `evil.com/@legit.com` and `base_url` returns `http://evil.com/@legit.com`. A valid `Host` together with an invalid `X-Forwarded-Host` produces the same result, because forwarded headers take priority by default. ## Impact Applications that build absolute URLs, redirects, or origin-dependent checks from `req.url`, `req.base_url`, or `req.host_with_port`, and that do not enforce a host allowlist, may emit URLs containing attacker-chosen characters such as `@`, `/`, `?`, `#`, spaces, or angle brackets. Generated links and `Location` headers can be redirected through userinfo tricks, string-based URL checks can be bypassed, and markup is reflected where the application does not escape the value. For example, `redirect` in Sinatra behind a proxy that forwards `X-Forwarded-Host` emits the raw invalid authority in `Location`. Rails overrides these methods in Action Dispatch and is not expected to be affected. Rack 3.1 and 3.2 are affected. Rack 2.2 did not receive the CVE-2026-34835 change and returns the raw value from every host method. ## Mitigation * Update to a patched version of Rack, in which `host_with_port` returns `nil` for an invalid authority and `base_url` falls back to the server's own name. * Enforce a host allowlist with `Rack::Protection::HostAuthorization`, `config.hosts` in Rails, or at the reverse proxy, and configure the proxy to overwrite `X-Forwarded-Host` and `Forwarded`. * Pin the authority with the `rack.request.config` `:authority` key where available.

References

Source records: GHSA-2j8w-xcrc-x985 (OSV.dev) · EPSS by FIRST, 2026-11-26.