Improper Validation of Syntactic Correctness of Input Affecting rack package, versions >=3.0.0, <3.1.23>=3.2.0, <3.2.8


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.35% (22nd percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-RUBY-RACK-22840106
  • published24 Nov 2026
  • disclosed9 Nov 2026
  • creditUnknown

Introduced: 9 Nov 2026

NewCVE-2026-125109  (opens in a new tab)
CWE-1286  (opens in a new tab)

How to fix?

Upgrade rack to version 3.1.23, 3.2.8 or higher.

Overview

rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Affected versions of this package are vulnerable to Improper Validation of Syntactic Correctness of Input via the host_with_port method in Rack::Request. An attacker can send an invalid Host, X-Forwarded-Host, or Forwarded: host= value containing characters such as /, @, ?, or #; host_with_port embeds it verbatim in URLs returned by base_url and url. Applications that use these values to build redirects or perform string-based URL checks without a host allowlist can emit attacker-controlled Location headers or have those checks bypassed.

Notes

  • For the X-Forwarded-Host path, Rack gives forwarded hosts precedence by default, so an invalid forwarded value can reach host_with_port even when Host is valid; this path requires the proxy or application to pass through the attacker-controlled forwarded header.
  • Rails applications using Action Dispatch are not reached by this Rack::Request flaw because Action Dispatch overrides these methods.

Workarounds

  • Enforce a host allowlist with Rack::Protection::HostAuthorization, Rails config.hosts, or at the reverse proxy, and configure the proxy to overwrite X-Forwarded-Host and Forwarded. This prevents attacker-supplied host values from being used in generated URLs and redirects.
  • Where available, pin the authority with the rack.request.config :authority key. This prevents request-supplied authority values from controlling generated URLs.

CVSS Base Scores

version 4.0
version 3.1