Skip to content
DoS Disclosed report Intermediate CVE-2023-28756

ReDoS( Ruby, Time)

The Time parser in Ruby's time gem mishandles invalid strings with specific characters, causing increased execution time. An attacker could send a crafted HTTP request to a Rails application using Rack::ConditionalGet, which parses the header with Time.rfc2822, leading to a denial of service.

ooooooo_q Follow

Originally disclosed on HackerOne

Bounty$4,000 High View original
  • Triaged in 5 days
  • Fixed in 24 days
  • Paid in 24 days
  • Disclosed after 24 days

Summary by the program

CVE-2023-28756: ReDoS vulnerability in Time

We have released the time gem version 0.1.1 and 0.2.2 that has a security fix for a ReDoS vulnerability. This vulnerability has been assigned the CVE identifier CVE-2023-28756.

Details The Time parser mishandles invalid strings that have specific characters. It causes an increase in execution time for parsing strings to Time objects.

A ReDoS issue was discovered in the Time gem 0.1.0 and 0.2.1 and Time library of Ruby 2.7.7.

Recommended action We recommend to update the time gem to version 0.2.2 or later. In order to ensure compatibility with bundled version in older Ruby series, you may update as follows instead:

For Ruby 3.0 users: Update to time 0.1.1 For Ruby 3.1/3.2 users: Update to time 0.2.2 You can use gem update time to update it. If you are using bundler, please add gem "time", ">= 0.2.2" to your Gemfile.

Unfortunately, time gem only works with Ruby 3.0 or later. If you are using Ruby 2.7, please use the latest version of Ruby.

Affected versions Ruby 2.7.7 or lower time gem 0.1.0 time gem 0.2.1

Credits Thanks to ooooooo_q for discovering this issue.

Security Advisory: https://www.ruby-lang.org/en/news/2023/03/30/redos-in-time-cve-2023-28756/

The report

I reported at https://hackerone.com/reports/1485501

https://www.ruby-lang.org/en/news/2023/03/30/redos-in-time-cve-2023-28756/

The Time parser mishandles invalid strings that have specific characters. It causes an increase in execution time for parsing strings to Time objects. A ReDoS issue was discovered in the Time gem 0.1.0 and 0.2.1 and Time library of Ruby 2.7.7.

Impact

ReDoS occurs when Time.rfc2822 accepts user input.

In Rack::ConditionalGet, the header value is parsed by Time.rfc2822, it is possible to attack from the request. Rails uses ::Rack::ConditionalGet by default, it can be attacked by a request from the client.

The original report as published on HackerOne, by ooooooo_q. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 in the Time parser that has catastrophic backtracking when processing invalid strings with specific characters.

Impact

An attacker could cause a denial of service by sending a crafted request to a Rails application that uses Rack::ConditionalGet, as the header value is parsed by Time.rfc2822.

What the attacker needed

Rails app using Rack::ConditionalGet; attacker can send HTTP requests

The fix

The vulnerability was fixed by updating the time gem to version 0.2.2 or later (or 0.1.1 for Ruby 3.0).

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 regular expression is a pattern used to match text. Some patterns can take a very long time to process certain inputs, which is called a ReDoS (Regular Expression Denial of Service). Here, the Time parser uses such a pattern, so an attacker can send a special string that makes the server spend too much time parsing it, potentially slowing down or crashing the service.

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.

More by ooooooo_q

View all

53 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.