Rack CVE-2022-30122: Denial of Service Vulnerability in Rack Multipart Parsing
Rack's multipart parser contained regular expressions that could be made to run very slowly by a carefully crafted multipart POST request. An attacker could send such a request to make the server spend excessive time parsing it, causing a denial of service.
- Triaged in 44 hours
- Fixed in 17 days
- Paid in 17 days
- Disclosed after 17 days
Summary by the program
Description 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.
Full Security Advisory: https://github.com/advisories/GHSA-hxqx-xwvh-44m2
The report
ReDoS in Rack::Multipart::BROKEN_QUOTED and Rack::Multipart::BROKEN_UNQUOTED.
https://groups.google.com/g/ruby-security-ann/c/L2Axto442qk
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.
Impact
When the client sends a specially crafted header, it occur ReDoS on the server side. Servers that interpret Post data by default, like Rails, are affected.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the regular expressions used to parse quoted and unquoted multipart header values were vulnerable to catastrophic backtracking (ReDoS).
Impact
A crafted multipart POST request could make the parser take much longer than expected, leading to a possible denial of service; servers that read POST data by default, such as Rails, are affected.
What the attacker needed
Ability to send a POST request to the app; app parses multipart POST data
The fix
It was fixed in versions [redacted], [redacted] and [redacted], and affected users should upgrade or apply the listed workarounds.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A web server has to read the data a browser sends when a form is submitted, including uploaded files. Rack, a library used by many Ruby web apps, used a pattern-matching rule that could be tricked into doing a huge amount of work on one specially shaped request. While the server is busy on that request, it cannot serve other users, so the site can appear down.
What is DoS?
A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.