RubySec

Providing security resources for the Ruby community

GHSA-vvhm-j6m8-64cw (rack-protection): rack-protection - a missing Referer is treated as same-origin, allowing a bypass of JsonCsrf, RemoteToken and RemoteReferrer

rack-protection - a missing Referer is treated as same-origin, allowing a bypass of JsonCsrf, RemoteToken and RemoteReferrer

Published: November 17, 2026

SECURITY IDENTIFIERS

GEM

rack-protection

SEVERITY

CVSS v3.x: 3.1 (Low)

PATCHED VERSIONS

>= 4.2.2

DESCRIPTION

Summary

Rack::Protection::JsonCsrf, Rack::Protection::RemoteToken and Rack::Protection::RemoteReferrer decide whether a request is same-origin by comparing the host of the Referer header with the host of the request. With the default allow_empty_referrer: true, a request without a Referer header was treated as if it came from the application itself. A cross-site page can make the browser leave the header out, for example with <meta name="referrer" content="no-referrer">, and so get past these protections.

Impact

The impact is limited by other protections and by current browsers:

  • Rack::Protection::HttpOrigin is enabled by default and still rejects cross-site unsafe requests whenever the browser sends an Origin header, which current browsers do for cross-site form posts, also when the referrer is suppressed (the header is then null). The bypass of RemoteToken and RemoteReferrer therefore matters for applications that use them without HttpOrigin, and for browsers that do not send Origin.

  • Reading a JSON response through a <script> element is not possible in current browsers. Rack::Protection::XSSHeader, enabled by default, also sends X-Content-Type-Options: nosniff, which makes browsers refuse to run a JSON response as a script.

Applications using Sinatra get Rack::Protection with JsonCsrf, HttpOrigin and XSSHeader enabled by default, and RemoteToken when sessions are enabled.

RELATED