Repository navigation
Three new rack-protection advisories #1333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | ||
| - ">= 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. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.