CVE-2026-34835: Rack: `Rack::Request` accepts invalid Host characters, enabling host allowlist bypass.

Published Apr 2, 2026
·
Updated

Summary

Rack::Request parses the Host header using an AUTHORITY regular expression that accepts characters not permitted in RFC-compliant hostnames, including /, ?, #, and @. Because req.host returns the full parsed value, applications that validate hosts using naive prefix or suffix checks can be bypassed.

For example, a check such as req.host.startwith?("myapp.com") can be bypassed with Host: myapp.com@evil.com, and a check such as req.host.endwith?("myapp.com") can be bypassed with Host: evil.com/myapp.com.

This can lead to host header poisoning in applications that use req.host, req.url, or req.baseurl for link generation, redirects, or origin validation.

Details

Rack::Request parses the authority component using logic equivalent to:

ruby AUTHORITY = / \A (?<host> \[(?<address>#{ipv6})\] | (?<address>[[[:graph:]&&[^\[\]]]]?) ) (:(?<port>\d+))? \z /x

The character class used for non-IPv6 hosts accepts nearly all printable characters except [ and ]. This includes reserved URI delimiters such as @, /, ?, and #, which are not valid hostname characters under RFC 3986 host syntax.

As a result, values such as the following are accepted and returned through req.host:

text myapp.com@evil.com evil.com/myapp.com evil.com#myapp.com

Applications that attempt to allowlist hosts using string prefix or suffix checks may therefore treat attacker-controlled hosts as trusted. For example:

ruby req.host.startwith?("myapp.com")

accepts:

text myapp.com@evil.com

and:

ruby req.host.endwith?("myapp.com")

accepts:

text evil.com/myapp.com

When those values are later used to build absolute URLs or enforce origin restrictions, the application may produce attacker-controlled results.

Impact

Applications that rely on req.host, req.url, or req.baseurl may be affected if they perform naive host validation or assume Rack only returns RFC-valid hostnames.

In affected deployments, an attacker may be able to bypass host allowlists and poison generated links, redirects, or origin-dependent security decisions. This can enable attacks such as password reset link poisoning or other host header injection issues.

The practical impact depends on application behavior. If the application or reverse proxy already enforces strict host validation, exploitability may be reduced or eliminated.

Mitigation

Update to a patched version of Rack that rejects invalid authority characters in Host. Enforce strict Host header validation at the reverse proxy or load balancer. Do not rely on prefix or suffix string checks such as startwith? or endwith? for host allowlisting. Use exact host allowlists, or exact subdomain boundary checks, after validating that the host is syntactically valid.

Other sources

Rack is a modular Ruby web server interface. From versions 3.0.0.beta1 to before 3.1.21, and 3.2.0 to before 3.2.6, Rack::Request parses the Host header using an AUTHORITY regular expression that accepts characters not permitted in RFC-compliant hostnames, including /, ?, #, and @. Because req.host returns the full parsed value, applications that validate hosts using naive prefix or suffix checks can be bypassed. This can lead to host header poisoning in applications that use req.host, req.url, or req.baseurl for link generation, redirects, or origin validation. This issue has been patched in versions 3.1.21 and 3.2.6.

MITRE

Affected Software

4 affected componentsFixes available
rubygems/rack>=3.2.0<3.2.6
3.2.6
rubygems/rack>=3.0.0.beta1<3.1.21
3.1.21
Rack Rack Ruby>=3.0.0<3.1.21
Rack Rack Ruby>=3.2.0<3.2.6

Event History

Apr 2, 2026
CVE Published
via MITRE·05:09 PM
Data Sourced
via MITRE·05:09 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeaknessAffected Software
Advisory Published
via GitHub·08:36 PM
Data Sourced
via GitHub·08:36 PM
DescriptionSeverityWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-34835?

CVE-2026-34835 is considered a high severity vulnerability due to its potential to allow host allowlist bypass.

2

How do I fix CVE-2026-34835?

To fix CVE-2026-34835, upgrade to Rack version 3.2.6 or 3.1.21 or later.

3

What software versions are affected by CVE-2026-34835?

CVE-2026-34835 affects Rack versions between 3.0.0 and 3.2.6, including 3.1.21.

4

What are the consequences of exploiting CVE-2026-34835?

Exploiting CVE-2026-34835 can lead to unauthorized access due to bypassing host allowlists.

5

Is CVE-2026-34835 specific to any particular application?

CVE-2026-34835 specifically affects applications utilizing the Rack framework for Ruby.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203