# 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
- **CVSS:** 4.8 (v3.1, GitHub) `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N`
- **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
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.35% (percentile 21, 2026-11-29)
- **CWE:** CWE-1286
- **Aliases:** GHSA-2j8w-xcrc-x985
- **Published:** 2026-11-10T19:11:28.000Z
- **Modified:** 2026-11-10T19:11:29.000Z

## Who should check

- Projects that depend on RubyGems package rack (\>= 3.0.0, \< 3.1.23)

## 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

- RubyGems `rack`: affected \>= 3.0.0, \< 3.1.23; fixed 3.1.23, 3.2.8 (ghsa)

## Technologies

RubyGems

## Mitigation

- Upgrade rack to one of 3.1.23, 3.2.8 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
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.
```

## 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-29).

### 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.

## References

- vendor: <https://github.com/rack/rack/security/advisories/GHSA-2j8w-xcrc-x985>
- patch: <https://github.com/rack/rack/commit/4380381a56dc52556a436d6d794c8e18dc8b0565>
- patch: <https://github.com/rack/rack/commit/49386f460286b7346c7003b69a839de782cc8a39>
- other: <https://nvd.nist.gov/vuln/detail/CVE-2026-125109>
- other: <https://github.com/rack/rack/releases/tag/v3.1.23>
- other: <https://github.com/rack/rack/releases/tag/v3.2.8>
- other: <https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rack/GHSA-2j8w-xcrc-x985.yml>
- other: <https://github.com/advisories/GHSA-2j8w-xcrc-x985>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- GitHub Advisory Database: CC-BY 4.0 <https://github.com/advisories/GHSA-2j8w-xcrc-x985> (license: <https://creativecommons.org/licenses/by/4.0/>)
- FIRST EPSS: EPSS scores by FIRST <https://www.first.org/epss/>

HTML: <https://flawdb.com/CVE-2026-125109> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-125109>
