RubySec

Providing security resources for the Ruby community

GHSA-r29j-38x9-qr26 (rack-protection): rack-protection - HostAuthorization permits unrelated hosts that end with a leading-dot permitted host

rack-protection - HostAuthorization permits unrelated hosts that end with a leading-dot permitted host

Published: November 17, 2026

SECURITY IDENTIFIERS

GEM

rack-protection

SEVERITY

CVSS v3.x: 4.2 (Medium)

UNAFFECTED VERSIONS

< 4.1.0

PATCHED VERSIONS

>= 4.2.2

DESCRIPTION

Summary

Rack::Protection::HostAuthorization lets an entry in permitted_hosts start with a dot to permit a domain and all its subdomains. The pattern built for such an entry did not require a dot before the domain, so .example.org also permitted any host that merely ends in example.org, such as evilexample.org. An attacker can register such a domain and get requests with that host past the protection.

Sinatra's default permitted_hosts in the development environment contain .localhost and .test, so a Sinatra application in development accepted hosts like evil.contest without any configuration.

Impact

HostAuthorization is the protection against DNS rebinding and other attacks that rely on an unexpected Host header. For an affected application it could be bypassed with a domain the attacker controls:

  • DNS rebinding: a page on the attacker's domain can, after the domain is rebound to the address of the application, send requests to it and read the responses from the victim's browser. This is the relevant attack for applications that are not reachable from the internet, such as one running on a developer's machine. A Sinatra application in the development environment is affected by default, through .test and .localhost.

  • Host header attacks: an application that uses the request host to build URLs, for example in redirects or in links sent by email, will use the attacker's host.

Applications are affected when permitted_hosts contains an entry with a leading dot. In environments other than development Sinatra's permitted_hosts is empty by default, which permits any host, so those applications are affected only when they have configured such an entry.

RELATED