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
Also known as GHSA-2j8w-xcrc-x985
Mitigation
- Upgrade rack to one of 3.1.23, 3.2.8 (or later in the same release line).
Who should check
- Projects that depend on RubyGems package rack (>= 3.0.0, < 3.1.23)
Vulnerability facts
- Affected
- rack >= 3.0.0, < 3.1.23
- Fixed in
- 3.1.23, 3.2.8
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 4.8 (v3.1, GitHub)CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: High
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: Low
- Integrity impact: Low
- Availability impact: None
- EPSS
- 0.35% chance of exploitation in 30 days (percentile 21, 2026-11-26)
- CWE
- CWE-1286
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| RubyGems rack | >= 3.0.0, < 3.1.23 | 3.1.23, 3.2.8 | ghsa |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2026-125109. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2026-125109.md Affected: rack >= 3.0.0, < 3.1.23 Fixed in: 3.1.23, 3.2.8 Steps: 1. Search this machine and project for rack (RubyGems): dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
Technologies
References
Vendor advisories
Patches
FAQ
Is CVE-2026-125109 being exploited?
There is no confirmed exploitation: CVE-2026-125109 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.35% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2026-125109?
Medium: CVSS 4.8 (v3.1, scored by GitHub). Remote, no login needed. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2026-125109?
rack >= 3.0.0, < 3.1.23.
Is there a fix for CVE-2026-125109?
Yes. Fixed in 3.1.23, 3.2.8. Upgrade rack to one of 3.1.23, 3.2.8 (or later in the same release line).
How do I check if I'm affected by CVE-2026-125109?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.
More rack vulnerabilities
See all| Severity | Identifier / vulnerability | Technology | Signals | Age |
|---|---|---|---|---|
| HIGH 8.7 | CVE-2026-125111 Rack: Multipart parsing allows DoS via unbounded scan buffer growth | RubyGems | EPSS 46% | |
| LOW 3.7 | CVE-2026-125108 Rack: Multipart boundary ambiguity guard in Rack::Multipart::Parser can be bypassed with a quoted boundary value, allowing WAF bypass | RubyGems | EPSS 24% | |
| MEDIUM 5.3 | CVE-2026-125110 Rack: Rack::Static header_rules bypass via dot-segment normalization mismatch | RubyGems | EPSS 29% |