Skip to content
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

chore(deps): update dependency rack to v2 [security] #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Dec 10, 2024

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
rack (changelog) '~>1.5.2' -> '~>2.2.8', '>= 2.2.8.1' age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2022-30123

There is a possible shell escape sequence injection vulnerability in the Lint
and CommonLogger components of Rack. This vulnerability has been assigned the
CVE identifier CVE-2022-30123.

Versions Affected: All.
Not affected: None
Fixed Versions: 2.0.9.1, 2.1.4.1, 2.2.3.1

Impact

Carefully crafted requests can cause shell escape sequences to be written to
the terminal via Rack's Lint middleware and CommonLogger middleware. These
escape sequences can be leveraged to possibly execute commands in the victim's
terminal.

Impacted applications will have either of these middleware installed, and
vulnerable apps may have something like this:

use Rack::Lint

Or

use Rack::CommonLogger

All users running an affected release should either upgrade or use one of the
workarounds immediately.

Workarounds

Remove these middleware from your application

CVE-2022-30122

There is a possible denial of service vulnerability in the multipart parsing component of Rack. This vulnerability has been assigned the CVE identifier CVE-2022-30122.

Versions Affected: >= 1.2
Not affected: < 1.2
Fixed Versions: 2.0.9.1, 2.1.4.1, 2.2.3.1

Impact

Carefully crafted multipart POST requests can cause Rack's multipart parser to take much longer than expected, leading to a possible denial of service vulnerability.

Impacted code will use Rack's multipart parser to parse multipart posts. This includes directly using the multipart parser like this:

params = Rack::Multipart.parse_multipart(env)

But it also includes reading POST data from a Rack request object like this:

p request.POST # read POST data
p request.params # reads both query params and POST data

All users running an affected release should either upgrade or use one of the workarounds immediately.

Workarounds

There are no feasible workarounds for this issue.

CVE-2022-44570

There is a possible denial of service vulnerability in the Range header parsing component of Rack. This vulnerability has been assigned the CVE identifier CVE-2022-44570.

Versions Affected: >= 1.5.0 Not affected: None. Fixed Versions: 2.0.9.2, 2.1.4.2, 2.2.6.2, 3.0.0.1
Impact

Carefully crafted input can cause the Range header parsing component in Rack to take an unexpected amount of time, possibly resulting in a denial of service attack vector. Any applications that deal with Range requests (such as streaming applications, or applications that serve files) may be impacted.
Releases

The fixed releases are available at the normal locations.
Workarounds

There are no feasible workarounds for this issue.
Patches

To aid users who aren’t able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset.

2-0-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch - Patch for 2.0 series
2-1-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch - Patch for 2.1 series
2-2-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch - Patch for 2.2 series
3-0-Fix-ReDoS-in-Rack-Utils.get_byte_ranges.patch - Patch for 3.0 series

CVE-2023-27530

There is a possible DoS vulnerability in the Multipart MIME parsing code in Rack. This vulnerability has been assigned the CVE identifier CVE-2023-27530.

Versions Affected: All. Not affected: None Fixed Versions: 3.0.4.2, 2.2.6.3, 2.1.4.3, 2.0.9.3

Impact

The Multipart MIME parsing code in Rack limits the number of file parts, but does not limit the total number of parts that can be uploaded. Carefully crafted requests can abuse this and cause multipart parsing to take longer than expected.

All users running an affected release should either upgrade or use one of the workarounds immediately.

Workarounds

A proxy can be configured to limit the POST body size which will mitigate this issue.

CVE-2018-16471

There is a possible XSS vulnerability in Rack before 2.0.6 and 1.6.11. Carefully crafted requests can impact the data returned by the scheme method on Rack::Request. Applications that expect the scheme to be limited to 'http' or 'https' and do not escape the return value could be vulnerable to an XSS attack. Note that applications using the normal escaping mechanisms provided by Rails may not impacted, but applications that bypass the escaping mechanisms, or do not use them may be vulnerable.

CVE-2019-16782

There's a possible information leak / session hijack vulnerability in Rack. Attackers may be able to find and hijack sessions by using timing attacks targeting the session id. Session ids are usually stored and indexed in a database that uses some kind of scheme for speeding up lookups of that session id. By carefully measuring the amount of time it takes to look up a session, an attacker may be able to find a valid session id and hijack the session.

The session id itself may be generated randomly, but the way the session is indexed by the backing store does not use a secure comparison.

Impact

The session id stored in a cookie is the same id that is used when querying the backing session storage engine. Most storage mechanisms (for example a database) use some sort of indexing in order to speed up the lookup of that id. By carefully timing requests and session lookup failures, an attacker may be able to perform a timing attack to determine an existing session id and hijack that session.

Releases

The 1.6.12 and 2.0.8 releases are available at the normal locations.

Workarounds

There are no known workarounds.

Patches

To aid users who aren't able to upgrade immediately we have provided patches for
the two supported release series. They are in git-am format and consist of a
single changeset.

  • 1-6-session-timing-attack.patch - Patch for 1.6 series
  • 2-0-session-timing-attack.patch - Patch for 2.6 series

Credits

Thanks Will Leinweber for reporting this!

CVE-2020-8184

A reliance on cookies without validation/integrity check security vulnerability exists in rack < 2.2.3, rack < 2.1.4 that makes it possible for an attacker to forge a secure or host-only cookie prefix.

CVE-2020-8161

A directory traversal vulnerability exists in rack < 2.2.0 that allows an attacker perform directory traversal vulnerability in the Rack::Directory app that is bundled with Rack which could result in information disclosure.

CVE-2024-26146

Possible Denial of Service Vulnerability in Rack Header Parsing

There is a possible denial of service vulnerability in the header parsing
routines in Rack. This vulnerability has been assigned the CVE identifier
CVE-2024-26146.

Versions Affected: All.
Not affected: None
Fixed Versions: 2.0.9.4, 2.1.4.4, 2.2.8.1, 3.0.9.1

Impact

Carefully crafted headers can cause header parsing in Rack to take longer than
expected resulting in a possible denial of service issue. Accept and Forwarded
headers are impacted.

Ruby 3.2 has mitigations for this problem, so Rack applications using Ruby 3.2
or newer are unaffected.

Releases

The fixed releases are available at the normal locations.

Workarounds

There are no feasible workarounds for this issue.

Patches

To aid users who aren't able to upgrade immediately we have provided patches for
the two supported release series. They are in git-am format and consist of a
single changeset.

  • 2-0-header-redos.patch - Patch for 2.0 series
  • 2-1-header-redos.patch - Patch for 2.1 series
  • 2-2-header-redos.patch - Patch for 2.2 series
  • 3-0-header-redos.patch - Patch for 3.0 series

Credits

Thanks to svalkanov for reporting this and
providing patches!

CVE-2024-26141

Possible DoS Vulnerability with Range Header in Rack

There is a possible DoS vulnerability relating to the Range request header in
Rack. This vulnerability has been assigned the CVE identifier CVE-2024-26141.

Versions Affected: >= 1.3.0.
Not affected: < 1.3.0
Fixed Versions: 3.0.9.1, 2.2.8.1

Impact

Carefully crafted Range headers can cause a server to respond with an
unexpectedly large response. Responding with such large responses could lead
to a denial of service issue.

Vulnerable applications will use the Rack::File middleware or the
Rack::Utils.byte_ranges methods (this includes Rails applications).

Releases

The fixed releases are available at the normal locations.

Workarounds

There are no feasible workarounds for this issue.

Patches

To aid users who aren't able to upgrade immediately we have provided patches for
the two supported release series. They are in git-am format and consist of a
single changeset.

  • 3-0-range.patch - Patch for 3.0 series
  • 2-2-range.patch - Patch for 2.2 series

Credits

Thank you ooooooo_q for the report and
patch

CVE-2024-25126

Summary

module Rack
  class MediaType
    SPLIT_PATTERN = %r{\s*[;,]\s*}

The above regexp is subject to ReDos. 50K blank characters as a prefix to the header will take over 10s to split.

PoC

A simple HTTP request with lots of blank characters in the content-type header:

request["Content-Type"] = (" " * 50_000) + "a,"

Impact

It's a very easy to craft ReDoS. Like all ReDoS the impact is debatable.


Release Notes

rack/rack (rack)

v2.2.8.1

Compare Source

What's Changed

Full Changelog: rack/rack@v2.2.8...v2.2.8.1

v2.2.8

Compare Source

What's Changed

New Contributors

Full Changelog: rack/rack@v2.2.7...v2.2.8

v2.2.7

Compare Source

What's Changed

New Contributors

Full Changelog: rack/rack@v2.2.6.4...v2.2.7

v2.2.6.4

Compare Source

v2.2.6.3

Compare Source

v2.2.6.2

Compare Source

v2.2.6.1

Compare Source

v2.2.6

Compare Source

v2.2.5

Compare Source

v2.2.4

Compare Source

v2.2.3.1

Compare Source

Security

v2.2.3

Compare Source

Security

v2.2.2

Compare Source

Fixed

v2.2.1

Compare Source

Fixed

v2.2.0

Compare Source

SPEC Changes
  • rack.session request environment entry must respond to to_hash and return unfrozen Hash. ([@​jeremyevans])
  • Request environment cannot be frozen. ([@​jeremyevans])
  • CGI values in the request environment with non-ASCII characters must use ASCII-8BIT encoding. ([@​jeremyevans])
  • Improve SPEC/lint relating to SERVER_NAME, SERVER_PORT and HTTP_HOST. (#​1561, [@​ioquatix])
Added
  • rackup supports multiple -r options and will require all arguments. ([@​jeremyevans])
  • Server supports an array of paths to require for the :require option. (@​khotta)
  • Files supports multipart range requests. (@​fatkodima)
  • Multipart::UploadedFile supports an IO-like object instead of using the filesystem, using :filename and :io options. ([@​jeremyevans])
  • Multipart::UploadedFile supports keyword arguments :path, :content_type, and :binary in addition to positional arguments. ([@​jeremyevans])
  • Static supports a :cascade option for calling the app if there is no matching file. ([@​jeremyevans])
  • Session::Abstract::SessionHash#dig. ([@​jeremyevans])
  • Response.[] and MockResponse.[] for creating instances using status, headers, and body. ([@​ioquatix])
  • Convenient cache and content type methods for Rack::Response. (#​1555, [@​ioquatix])
Changed
  • Request#params no longer rescues EOFError. ([@​jeremyevans])
  • Directory uses a streaming approach, significantly improving time to first byte for large directories. ([@​jeremyevans])
  • Directory no longer includes a Parent directory link in the root directory index. ([@​jeremyevans])
  • QueryParser#parse_nested_query uses original backtrace when reraising exception with new class. ([@​jeremyevans])
  • ConditionalGet follows RFC 7232 precedence if both If-None-Match and If-Modified-Since headers are provided. ([@​jeremyevans])
  • .ru files supports the frozen-string-literal magic comment. (@​eregon)
  • Rely on autoload to load constants instead of requiring internal files, make sure to require 'rack' and not just 'rack/...'. ([@​jeremyevans])
  • BREAKING CHANGE: Etag will continue sending ETag even if the response should not be cached. Streaming no longer works without a workaround, see #​1619. (@​henm)
  • Request#host_with_port no longer includes a colon for a missing or empty port. (@​AlexWayfer)
  • All handlers uses keywords arguments instead of an options hash argument. ([@​ioquatix])
  • Files handling of range requests no longer return a body that supports to_path, to ensure range requests are handled correctly. ([@​jeremyevans])
  • Multipart::Generator only includes Content-Length for files with paths, and Content-Disposition filename if the UploadedFile instance has one. ([@​jeremyevans])
  • Request#ssl? is true for the wss scheme (secure websockets). ([@​jeremyevans])
  • Rack::HeaderHash is memoized by default. (#​1549, [@​ioquatix])
  • Rack::Directory allow directory traversal inside root directory. (#​1417, @​ThomasSevestre)
  • Sort encodings by server preference. (#​1184, [@​ioquatix], @​wjordan)
  • Rework host/hostname/authority implementation in Rack::Request. #host and #host_with_port have been changed to correctly return IPv6 addresses formatted with square brackets, as defined by RFC3986. (#​1561, [@​ioquatix])
  • Rack::Builder parsing options on first #\ line is deprecated. (#​1574, [@​ioquatix])
Removed
  • Directory#path as it was not used and always returned nil. ([@​jeremyevans])
  • BodyProxy#each as it was only needed to work around a bug in Ruby <1.9.3. ([@​jeremyevans])
  • URLMap::INFINITY and URLMap::NEGATIVE_INFINITY, in favor of Float::INFINITY. (@​ch1c0t)
  • Deprecation of Rack::File. It will be deprecated again in rack 2.2 or 3.0. (@​rafaelfranca)
  • Support for Ruby 2.2 as it is well past EOL. ([@​ioquatix])
  • Remove Rack::Files#response_body as the implementation was broken. (#​1153, [@​ioquatix])
  • Remove SERVER_ADDR which was never part of the original SPEC. (#​1573, [@​ioquatix])
Fixed
  • Directory correctly handles root paths containing glob metacharacters. ([@​jeremyevans])
  • Cascade uses a new response object for each call if initialized with no apps. ([@​jeremyevans])
  • BodyProxy correctly delegates keyword arguments to the body object on Ruby 2.7+. ([@​jeremyevans])
  • BodyProxy#method correctly handles methods delegated to the body object. ([@​jeremyevans])
  • Request#host and Request#host_with_port handle IPv6 addresses correctly. (@​AlexWayfer)
  • Lint checks when response hijacking that rack.hijack is called with a valid object. ([@​jeremyevans])
  • Response#write correctly updates Content-Length if initialized with a body. ([@​jeremyevans])
  • CommonLogger includes SCRIPT_NAME when logging. (@​Erol)
  • Utils.parse_nested_query correctly handles empty queries, using an empty instance of the params class instead of a hash. ([@​jeremyevans])
  • Directory correctly escapes paths in links. (@​yous)
  • Request#delete_cookie and related Utils methods handle :domain and :path options in same call. ([@​jeremyevans])
  • Request#delete_cookie and related Utils methods do an exact match on :domain and :path options. ([@​jeremyevans])
  • Static no longer adds headers when a gzipped file request has a 304 response. (@​chooh)
  • ContentLength sets Content-Length response header even for bodies not responding to to_ary. ([@​jeremyevans])
  • Thin handler supports options passed directly to Thin::Controllers::Controller. ([@​jeremyevans])
  • WEBrick handler no longer ignores :BindAddress option. ([@​jeremyevans])
  • ShowExceptions handles invalid POST data. ([@​jeremyevans])
  • Basic authentication requires a password, even if the password is empty. ([@​jeremyevans])
  • Lint checks response is array with 3 elements, per SPEC. ([@​jeremyevans])
  • Support for using :SSLEnable option when using WEBrick handler. (Gregor Melhorn)
  • Close response body after buffering it when buffering. ([@​ioquatix])
  • Only accept ; as delimiter when parsing cookies. (@​mrageh)
  • Utils::HeaderHash#clear clears the name mapping as well. (@​raxoft)
  • Support for passing nil Rack::Files.new, which notably fixes Rails' current ActiveStorage::FileServer implementation. ([@​ioquatix])
Documentation

v2.1.4.4

Compare Source

What's Changed

Full Changelog: rack/rack@v2.1.4.3...v2.1.4.4

v2.1.4.3

Compare Source

v2.1.4.2

Compare Source

v2.1.4.1

Compare Source

v2.1.4

Compare Source

v2.1.3

Compare Source

v2.1.2

Compare Source

  • Fix multipart parser for some files to prevent denial of service (@​aiomaster)
  • Fix Rack::Builder#use with keyword arguments (@​kamipo)
  • Skip deflating in Rack::Deflater if Content-Length is 0 ([@​jeremyevans])
  • Remove SessionHash#transform_keys, no longer needed (@​pavel)
  • Add to_hash to wrap Hash and Session classes (@​oleh-demyanyuk)
  • Handle case where session id key is requested but missing ([@​jeremyevans])

v2.1.1

Compare Source

v2.1.0

Compare Source

Added
  • Add support for SameSite=None cookie value. (@​hennikul)
  • Add trailer headers. (@​eileencodes)
  • Add MIME Types for video streaming. (@​styd)
  • Add MIME Type for WASM. (@​buildrtech)
  • Add Early Hints(103) to status codes. (@​egtra)
  • Add Too Early(425) to status codes. (@​y-yagi)
  • Add Bandwidth Limit Exceeded(509) to status codes. (@​CJKinni)
  • Add method for custom ip_filter. (@​svcastaneda)
  • Add boot-time profiling capabilities to rackup. (@​tenderlove)
  • Add multi mapping support for X-Accel-Mappings header. (@​yoshuki)
  • Add sync: false option to Rack::Deflater. (Eric Wong)
  • Add Builder#freeze_app to freeze application and all middleware instances. ([@​jeremyevans])
  • Add API to extract cookies from Rack::MockResponse. (@​petercline)
Changed
  • Don't propagate nil values from middleware. ([@​ioquatix])
  • Lazily initialize the response body and only buffer it if required. ([@​ioquatix])
  • Fix deflater zlib buffer errors on empty body part. (@​felixbuenemann)
  • Set X-Accel-Redirect to percent-encoded path. (@​diskkid)
  • Remove unnecessary buffer growing when parsing multipart. (@​tainoe)
  • Expand the root path in Rack::Static upon initialization. (@​rosenfeld)
  • Make ShowExceptions work with binary data. (@​axyjo)
  • Use buffer string when parsing multipart requests. (@​janko-m)
  • Support optional UTF-8 Byte Order Mark (BOM) in config.ru. (@​mikegee)
  • Handle X-Forwarded-For with optional port. (@​dpritchett)
  • Use Time#httpdate format for Expires, as proposed by RFC 7231. (@​nanaya)
  • Make Utils.status_code raise an error when the status symbol is invalid instead of 500. (@​adambutler)
  • Rename Request::SCHEME_WHITELIST to Request::ALLOWED_SCHEMES.
  • Make Multipart::Parser.get_filename accept files with + in their name. (@​lucaskanashiro)
  • Add Falcon to the default handler fallbacks. ([@​ioquatix])
  • Update codebase to avoid string mutations in preparation for frozen_string_literals. (@​pat)
  • Change MockRequest#env_for to rely on the input optionally responding to #size instead of #length. (@​janko)
  • Rename Rack::File -> Rack::Files and add deprecation notice. (@​postmodern)
  • Prefer Base64 “strict encoding” for Base64 cookies. ([@​ioquatix])
Removed
  • BREAKING CHANGE: Remove to_ary from Response (@​tenderlove)
  • Deprecate Rack::Session::Memcache in favor of Rack::Session::Dalli from dalli gem (@​fatkodima)
Fixed
Documentation

v2.0.9.4

Compare Source

What's Changed

Full Changelog: rack/rack@v2.0.9.3...v2.0.9.4

v2.0.9.3

Compare Source

v2.0.9.2

Compare Source

v2.0.9.1

Compare Source

v2.0.9

Compare Source

  • Handle case where session id key is requested but missing ([@​jeremyevans])
  • Restore support for code relying on SessionId#to_s. ([@​jeremyevans])
  • Add support for SameSite=None cookie value. (@​hennikul)

v2.0.8

Compare Source

Security

v2.0.7

Compare Source

Fixed
  • Remove calls to #eof? on Rack input in Multipart::Parser, as this breaks the specification. (@​matthewd)
  • Preserve forwarded IP addresses for trusted proxy chains. (@​SamSaffron)

v2.0.6

Compare Source

Fixed

v2.0.5

Compare Source

Fixed
  • Record errors originating from invalid UTF8 in MethodOverride middleware instead of breaking. (@​mclark)

v2.0.4

Compare Source

Changed
  • Ensure the Lock middleware passes the original env object. (@​lugray)
  • Improve performance of Multipart::Parser when uploading large files. (@​tompng)
  • Increase buffer size in Multipart::Parser for better performance. (@​jkowens)
  • Reduce memory usage of Multipart::Parser when uploading large files. (@​tompng)
  • Replace ConcurrentRuby dependency with native Queue. (@​devmchakan)
Fixed
  • Require the correct digest algorithm in the ETag middleware. (@​matthewd)
Documentation

v2.0.3

Compare Source

Changed
Fixed
  • Prevent exceptions when a class with mixins inherits from Session::Abstract::ID. (@​jnraine)

v2.0.2

Compare Source

Added
  • Allow Session::Abstract::SessionHash#fetch to accept a block with a default value. (@​yannvanhalewyn)
  • Add Builder#freeze_app to freeze application and all middleware. ([@​jeremyevans])
Changed
  • Freeze default session options to avoid accidental mutation. (@​kirs)
  • Detect partial hijack without hash headers. (@​devmchakan)
  • Update tests to use MiniTest 6 matchers. (@​tonytonyjan)
  • Allow 205 Reset Content responses to set a Content-Length, as RFC 7231 proposes setting this to 0. (@​devmchakan)
Fixed
  • Handle NULL bytes in multipart filenames. (@​casperisfine)
  • Remove warnings due to miscapitalized global. ([@​ioquatix])
  • Prevent exceptions caused by a race condition on multi-threaded servers. (@​sophiedeziel)
  • Add RDoc as an explicit dependency for doc group. (@​tonytonyjan)
  • Record errors originating from Multipart::Parser in the MethodOverride middleware instead of letting them bubble up. (@​carlzulauf)
  • Remove remaining use of removed Utils#bytesize method from the File middleware. (@​brauliomartinezlm)
Removed
  • Remove deflate encoding support to reduce caching overhead. (@​devmchakan)
Documentation
  • Update broken example in Deflater documentation. (@​mwpastore)

v2.0.1

Compare Source

Changed

v1.6.13

Compare Source

v1.6.12

Compare Source

Security

v1.6.11

Compare Source

v1.6.10

Compare Source

v1.6.9

Compare Source

v1.6.8

Compare Source

v1.6.7

Compare Source

v1.6.6

Compare Source

v1.6.5

Compare Source

v1.6.4

Compare Source

v1.6.3

Compare Source

v1.6.2

Compare Source

v1.6.1

Compare Source

Security

v1.6.0

Compare Source

  • Response#unauthorized? helper
    • Deflater now accepts an options hash to control compression on a per-request level
    • Builder#warmup method for app preloading
    • Request#accept_language method to extract HTTP_ACCEPT_LANGUAGE
    • Add quiet mode of rack server, rackup --quiet
    • Update HTTP Status Codes to RFC 7231
    • Less strict header name validation according to RFC 2616
    • SPEC updated to specify headers conform to RFC7230 specification
    • Etag correctly marks etags as weak
    • Request#port supports multiple x-http-forwarded-proto values
    • Utils#multipart_part_limit configures the maximum number of parts a request can contain
    • Default host to localhost when in development mode
    • Various bugfixes and performance improvements

v1.5.5

Compare Source

v1.5.4

Compare Source

v1.5.3

Compare Source

  • Fix CVE-2014-9490, denial of service attack in OkJson
    • Backport bug fixes to 1.5 series

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot force-pushed the renovate/rubygems-rack-vulnerability branch from bba6044 to 84d7b6e Compare December 10, 2024 12:49
@renovate renovate bot changed the title chore(deps): update dependency rack to '~>1.6.0' [security] chore(deps): update dependency rack to v2 [security] Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants