[CVE-2024-26142] ReDoS vulnerability in Accept header parsing in Action Dispatch
The Accept header parsing code in Action Dispatch could take an unexpectedly long time when given a carefully crafted header. An attacker could use this to cause a denial of service against affected Rails applications.
- Triaged in 40 hours
- Fixed in 19 days
- Paid in 19 days
- Disclosed after 49 days
Summary by the program
Possible ReDoS vulnerability in Accept header parsing in Action Dispatch
There is a possible ReDoS vulnerability in the Accept header parsing routines of Action Dispatch. This vulnerability has been assigned the CVE identifier CVE-2024-26142.
Versions Affected: >= 7.1.0, < 7.1.3.1 Not affected: < 7.1.0 Fixed Versions: 7.1.3.1
Impact Carefully crafted Accept headers can cause Accept header parsing in Action Dispatch to take an unexpected amount of time, possibly resulting in a DoS vulnerability. All users running an affected release should either upgrade or use one of the workarounds immediately.
Ruby 3.2 has mitigations for this problem, so Rails applications using Ruby 3.2 or newer are unaffected.
Credits Thanks svalkanov for the report and patch!
The report
I've made a report and provided a patch https://discuss.rubyonrails.org/t/possible-redos-vulnerability-in-accept-header-parsing-in-action-dispatch/84946
Impact
Carefully crafted Accept headers can cause Accept header parsing in Action Dispatch to take an unexpected amount of time, possibly resulting in a DoS vulnerability.
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 a regular expression used to parse the Accept header had catastrophic backtracking on certain crafted inputs.
Impact
A crafted Accept header could make parsing take an unexpected amount of time, possibly resulting in a denial of service; applications on Ruby 3.2 or newer are unaffected because Ruby has mitigations.
What the attacker needed
Send a crafted Accept header; affected Rails 7.1.0 to [redacted]; Ruby older than 3.2
The fix
It was fixed in version 7.1.3.1, and upgrading or applying the workarounds is advised.
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.
When a browser asks a website for a page, it sends an 'Accept' header saying which content types it understands. The server reads this header, and a carefully crafted header can make that parsing take an unexpectedly long time, tying up the server. This kind of slowdown attack is called ReDoS.
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.