See how sinatrarb compares to other vendors in security performance
Summary
There is a denial of service vulnerability in the If-Match and If-None-Match header parsing component of Sinatra, if the etag method is used when constructing the response and you are using Ruby < 3.2.
Details
Carefully crafted input can cause If-Match and If-None-Match header parsing in Sinatra to take an unexpected amount of time, possibly resulting in a denial of service attack vector. This header is typically involved in generating the ETag header value. Any applications that use the etag method when generating a response are impacted if they are using Ruby below version 3.2.
Resources
https://github.com/sinatra/sinatra/issues/2120 (report) https://github.com/sinatra/sinatra/pull/2121 (fix) https://github.com/sinatra/sinatra/pull/1823 (older ReDoS vulnerability) https://bugs.ruby-lang.org/issues/19104 (fix in Ruby >= 3.2)
Sinatra is a domain-specific language for creating web applications in Ruby. An issue was discovered in Sinatra 2.0 before 2.2.3 and 3.0 before 3.0.4. An application is vulnerable to a reflected file download (RFD) attack that sets the Content-Disposition header of a response when the filename is derived from user-supplied input. Version 2.2.3 and 3.0.4 contain patches for this issue.
A flaw was found in Sinatra when serving static files from the public directory. The requested path is not validated if it is in the public directory, allowing files outside of the public directory to be served.
It was found that Sinatra is vulnerable to an XSS via the 400 Bad Request page that occurs upon a params parser exception.
Upstream issue:
https://github.com/sinatra/sinatra/issues/1428
Introduced by:
https://github.com/sinatra/sinatra/commit/8f8df53ff29938ace79b31097c27d9cdac803b44
Upstream patch:
https://github.com/sinatra/sinatra/commit/12786867d6faaceaec62c7c2cb5b0e2dc074d71a
An issue was discovered in rack-protection/lib/rack/protection/pathtraversal.rb in Sinatra 2.x before 2.0.1 on Windows. Path traversal is possible via backslash characters.
A flaw was found in rack-protection. Versions prior to 2.0.0.rc3 of the package are vulnerable to Timing Attack due to time-variable comparison of signatures. A malicious user can guess a valid signature one char at a time by considering the time it takes a signature validation to fail.
References: https://snyk.io/vuln/SNYK-RUBY-SINATRA-20470 https://snyk.io/vuln/SNYK-RUBY-RACKPROTECTION-20395
Patch: https://github.com/sinatra/sinatra/commit/8aa6c42ef724f93ae309fb7c5668e19ad547eceb