Skip to content

GHSA-rqv2-275x-2jq5 CVE-2022-44572

Denial of service via multipart parsing in Rack

Low RubyGems
Severity
Low
The publisher's own rating, not a CVSS score
Exploit chance (EPSS)
1.62%
Chance of exploitation in the next 30 days. Higher than 76.04% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-1333 Inefficient Regular Expression Complexity
CWE-400 Uncontrolled Resource Consumption
Fix
2.0.9.2
Upgrade rack to this version or later

Description

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

Versions Affected: >= 2.0.0 Not affected: None. Fixed Versions: 2.0.9.2, 2.1.4.2, 2.2.6.1, 3.0.0.1 Impact

Carefully crafted input can cause RFC2183 multipart boundary parsing in Rack to take an unexpected amount of time, possibly resulting in a denial of service attack vector. Any applications that parse multipart posts using Rack (virtually all Rails applications) are 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-Forbid-control-characters-in-attributes.patch - Patch for 2.0 series
2-1-Forbid-control-characters-in-attributes.patch - Patch for 2.1 series
2-2-Forbid-control-characters-in-attributes.patch - Patch for 2.2 series
3-0-Forbid-control-characters-in-attributes.patch - Patch for 3.0 series

Affected versions

RubyGems

PackageVulnerableFixed in
rack
>= 2.0.0, < 2.0.9.2
2.0.9.2
rack
>= 2.1.0.0, < 2.1.4.2
2.1.4.2
rack
>= 2.2.0.0, < 2.2.6.1
2.2.6.1
rack
>= 3.0.0.0, < 3.0.4.1
3.0.4.1

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

rack RubyGems → 2.0.9.2

bundler
bundle update rack # Gemfile: gem "rack", ">= 2.0.9.2"

Weakness

CWE-1333: Inefficient Regular Expression Complexity

The product uses a regular expression with a worst-case computational complexity that is inefficient and possibly exponential.

How to prevent it
  • Architecture and Design: Use regular expressions that do not support backtracking, e.g. by removing nested quantifiers.
  • System Configuration: Set backtracking limits in the configuration of the regular expression implementation, such as PHP's pcre.backtrack_limit. Also consider limits on execution time for the process.
  • Implementation: Do not use regular expressions with untrusted input. If regular expressions must be used, avoid using backtracking in the expression.
  • Implementation: Limit the length of the input that the regular expression will process.

CWE-400: Uncontrolled Resource Consumption

The product does not properly control the allocation and maintenance of a limited resource.

How to prevent it
  • Architecture and Design: Design throttling mechanisms into the system architecture. The best protection is to limit the amount of resources that an unauthorized user can cause to be expended. A strong authentication and access control model will help prevent such attacks from occurring in the first place. The login application should be protected against DoS attacks as much as possible. Limiting the database access, perhaps by caching result sets, can help minimize the resources expended. To further limit the potential for a DoS attack, consider tracking the rate of requests received from users and blocking requests that exceed a defined rate threshold.
  • Architecture and Design: Mitigation of resource exhaustion attacks requires that the target system either: recognizes the attack and denies that user further access for a given amount of time, or uniformly throttles all requests in order to make it more difficult to consume resources more quickly than they can again be freed. The first of these solutions is an issue in itself though, since it may allow attackers to prevent the use of the system by a particular valid user. If the attacker impersonates the valid user, they may be able to prevent the user from accessing the server in question. The second solution is simply difficult to effectively institute -- and even when properly done, it does not provide a full solution. It simply makes the attack require more resources on the part of the attacker.
  • Architecture and Design: Ensure that protocols have specific limits of scale placed on them.
  • Implementation: Ensure that all failures in resource allocation place the system into a safe posture.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-g2pf-xv49-m2h5
Rack::Request accepts invalid Host characters, enabling host allowlist bypass
Medium Also affects rack
GHSA-v6x5-cg8r-vv6x
Rack's multipart header parsing allows Denial of Service via escape-heavy quoted parameters
High Also affects rack
GHSA-qfgr-crr9-7r49
Rack: Forwarded Header semicolon injection enables Host and Scheme spoofing
Medium Also affects rack
GHSA-rx22-g9mx-qrhv
Rack's improper unfolding of folded multipart headers preserves CRLF in parsed parameter values
Medium Also affects rack
GHSA-q2ww-5357-x388
Rack has Content-Length mismatch in Rack::Files error responses
Medium Also affects rack
GHSA-qv7j-4883-hwh7
Rack::Sendfile header-based X-Accel-Mapping regex injection enables unauthorized X-Accel-Redirect
High Also affects rack
GHSA-8vqr-qjwx-82mw
Rack's multipart parsing without Content-Length header allows unbounded chunked file uploads
High Also affects rack
GHSA-x8cg-fq8g-mxfx
Rack's multipart byte range processing allows denial of service via excessive overlapping ranges
High Also affects rack
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor