Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions gems/rack-protection/GHSA-pf75-2v58-7mxg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
gem: rack-protection
ghsa: pf75-2v58-7mxg
url: https://github.com/sinatra/sinatra/security/advisories/GHSA-pf75-2v58-7mxg
title: rack-protection - one request makes CookieTossing reject, or
drop the session of, every later request
date: 2026-11-17
description: |
## Summary

Rack::Protection::CookieTossing kept the list of bad cookies it
found on the middleware instance, which serves every request of
the application, and never cleared it. After a single request with
a duplicated session cookie, the middleware treated every later
request, from every client, as a cookie tossing attack, until
the process was restarted.

Only applications that have enabled the middleware are affected.
It is not part of the default Rack::Protection stack and
Sinatra does not enable it.

## Impact

Denial of service, by anyone who can send a request to the application,
with a single request. What happens to the later requests depends
on the reaction the middleware is configured with:

* With reaction: :deny, the default of the middleware when used on
its own, every request is answered with 403 Forbidden.

* With reaction: :drop_session, the default when enabled through
Sinatra's set :protection, use: :cookie_tossing, the session of
every request is cleared, so nobody can stay logged in.

In addition, every later response carries Set-Cookie headers that
expire the collected cookie names, one per name and path segment,
so repeated requests make all responses grow.

The application recovers only when its processes are restarted.
No data is exposed.
cvss_v3: 7.5
unaffected_versions:
- "< 2.0.0"
patched_versions:
- ">= 4.2.2"
related:
url:
- https://rubygems.org/gems/rack-protection/versions/4.2.2
- https://github.com/sinatra/sinatra/compare/v4.2.1...v4.2.2
- https://github.com/sinatra/sinatra/blob/main/rack-protection/lib/rack/protection/cookie_tossing.rb
- https://github.com/sinatra/sinatra/security/advisories/GHSA-pf75-2v58-7mxg
notes: |
- No CVE from GHSA URL.
- cvss_v3 from GHSA URL.
59 changes: 59 additions & 0 deletions gems/rack-protection/GHSA-r29j-38x9-qr26.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
gem: rack-protection
ghsa: r29j-38x9-qr26
url: https://github.com/sinatra/sinatra/security/advisories/GHSA-r29j-38x9-qr26
title: rack-protection - HostAuthorization permits unrelated hosts
that end with a leading-dot permitted host
date: 2026-11-17
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.
cvss_v3: 4.2
unaffected_versions:
- "< 4.1.0"
patched_versions:
Comment thread
jasnow marked this conversation as resolved.
Resolved
- ">= 4.2.2"
related:
url:
- https://rubygems.org/gems/rack-protection/versions/4.2.2
- https://github.com/sinatra/sinatra/compare/v4.2.1...v4.2.2
- https://github.com/sinatra/sinatra/blob/main/rack-protection/lib/rack/protection/host_authorization.rb
- https://en.wikipedia.org/wiki/DNS_rebinding
- https://portswigger.net/web-security/host-header
- https://github.com/sinatra/sinatra/security/advisories/GHSA-r29j-38x9-qr26
notes: |
- No CVE from GHSA URL.
- cvss_v3 from GHSA URL.
53 changes: 53 additions & 0 deletions gems/rack-protection/GHSA-vvhm-j6m8-64cw.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
gem: rack-protection
ghsa: vvhm-j6m8-64cw
url: https://github.com/sinatra/sinatra/security/advisories/GHSA-vvhm-j6m8-64cw
title: rack-protection - a missing Referer is treated as same-origin,
allowing a bypass of JsonCsrf, RemoteToken and RemoteReferrer
date: 2026-11-17
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.
cvss_v3: 3.1
patched_versions:
- ">= 4.2.2"
related:
url:
- https://rubygems.org/gems/rack-protection/versions/4.2.2
- https://github.com/sinatra/sinatra/compare/v4.2.1...v4.2.2
- https://github.com/sinatra/sinatra/blob/main/rack-protection/lib/rack/protection/json_csrf.rb
- https://github.com/sinatra/sinatra/blob/main/rack-protection/lib/rack/protection/remote_token.rb
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Sec-Fetch-Site
- https://github.com/sinatra/sinatra/security/advisories/GHSA-vvhm-j6m8-64cw
notes: |
- No CVE from GHSA URL.
- cvss_v3 from GHSA URL.