RubyGems
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
- Severity
- Medium 4.8
- Published
- 10 Nov 2026
- Last changed
- 10 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 3.1.23, 3.2.8
- Exploit chance
- 0.3% in the next 30 daysHigher than 22% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- CWE-1286
- Attack
- Over the network · Only under certain conditions · No login needed · No user action needed
- Attacker can
- Read some data · Change some data
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N- Also known as
- GHSA-2j8w-xcrc-x985
- Sources
- OSV.dev and GitHub
Description
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.
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.
Workarounds
- 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 software
| Software | Affected versions |
|---|---|
rackRubyGems · osv:RubyGems:rack |
|
About rack
- Total downloads (RubyGems)
- 1,398,166,843RubyGems, 24 Nov 2026
Vulnerabilities in rack
- In our list
- 4
- Published in the last 12 months
- 4
- Critical, last 12 months
- 0
- High, last 12 months
- 1
- Known exploited
- 0
- CVE-2026-125111Rack: Multipart parsing allows DoS via unbounded scan buffer growthHigh 7.5 10 Nov 2026
- CVE-2026-125108Rack: Multipart boundary ambiguity guard in Rack::Multipart::Parser can be bypassed with a quoted boundary value, allowing WAF bypassLow 3.7 10 Nov 2026
- CVE-2026-125110Rack: Rack::Static header_rules bypass via dot-segment normalization mismatchMedium 5.3 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-125109
- GitHub Advisory Database https://github.com/advisories/GHSA-2j8w-xcrc-x985