CVE-2021-41817: High severity ruby vulnerability

Published Nov 15, 2021
·
Updated

A flaw was found in ruby, where the date object was found to be vulnerable to a regular expression denial of service (ReDoS) during the parsing of dates. This flaw allows an attacker to hang a ruby application by providing a specially crafted date string. The highest threat to this vulnerability is system availability.

Other sources

Date.parse in the date gem through 3.2.0 for Ruby allows ReDoS (regular expression Denial of Service) via a long string. The fixed versions are 3.2.1, 3.1.2, 3.0.2, and 2.0.1.

Date’s parsing methods including Date.parse are using Regexps internally, some of which are vulnerable against regular expression denial of service. Applications and libraries that apply such methods to untrusted input may be affected.

References:

https://github.com/rubysec/ruby-advisory-db/blob/master/gems/date/CVE-2021-41817.yml https://www.ruby-lang.org/en/news/2021/11/15/date-parsing-method-regexp-dos-cve-2021-41817/

Red Hat

Date’s parsing methods including Date.parse are using Regexps internally, some of which are vulnerable against regular expression denial of service. Applications and libraries that apply such methods to untrusted input may be affected.

The fix limits the input length up to 128 bytes by default instead of changing the regexps. This is because Date gem uses many Regexps and it is possible that there are still undiscovered vulnerable Regexps. For compatibility, it is allowed to remove the limitation by explicitly passing limit keywords as nil like Date.parse(str, limit: nil), but note that it may take a long time to parse.

Please update the date gem to version 3.2.1, 3.1.2, 3.0.2, and 2.0.1, or later. You can use gem update date to update it. If you are using bundler, please add gem "date", ">= 3.2.1" to your Gemfile. If you import date from the standard library rather than as a gem you should update your Ruby install to 3.0.3, 2.7.5, 2.6.9 or later.

Users unable to upgrade may consider using Date.strptime instead with a predefined date format ruby Date.strptime('2001-02-20', '%Y-%m-%d')

GitHub

Affected Software

33 affected componentsFixes available
redhat/rh-ruby26-ruby<0:2.6.9-120.el7
0:2.6.9-120.el7
redhat/rh-ruby30-ruby<0:3.0.4-149.el7
0:3.0.4-149.el7
redhat/rh-ruby27-ruby<0:2.7.6-131.el7
0:2.7.6-131.el7
redhat/ruby-date<3.2.1
3.2.1
redhat/ruby-date<3.1.2
3.1.2
redhat/ruby-date<3.0.2
3.0.2
redhat/ruby-date<2.0.1
2.0.1
redhat/ruby<3.0.3
3.0.3
redhat/ruby<2.7.5
2.7.5
redhat/ruby<2.6.9
2.6.9
rubygems/date<2.0.1
2.0.1
rubygems/date>=3.0.0<3.0.2
3.0.2
rubygems/date>=3.1.0<3.1.2
3.1.2
rubygems/date>=3.2.0<3.2.1
3.2.1
ruby-lang Date Ruby<2.0.1
ruby-lang Date Ruby>=3.0.0<3.0.2
ruby-lang Date Ruby>=3.1.0<3.1.2
ruby-lang Date Ruby=3.2.0
ruby-lang Ruby>=2.6.0<2.6.9
ruby-lang Ruby>=2.7.0<2.7.5
ruby-lang Ruby>=3.0.0<3.0.3
redhat Software Collections
redhat Enterprise Linux=7.0
redhat Enterprise Linux=8.0
Fedoraproject Fedora=34
Fedoraproject Fedora=35
Debian Debian Linux=9.0
Debian Debian Linux=10.0
Debian Debian Linux=11.0
SUSE Linux Enterprise=12.0
SUSE Linux Enterprise=15.0
openSUSE Factory
openSUSE Leap=15.2

Event History

Nov 15, 2021
CVE Published
12:00 AM
Nov 16, 2021
Advisory Published
via GitHub·12:32 AM
Nov 19, 2021
Data Sourced
via Red Hat·09:05 PM
DescriptionSeverityAffected Software
Jan 1, 2022
CVE Published
via MITRE·12:00 AM
Data Sourced
via MITRE·12:00 AM
Description
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is CVE-2021-41817?

CVE-2021-41817 is a vulnerability in the date parsing method of the Ruby date gem that allows for regular expression Denial of Service (ReDoS) attacks.

2

What is the severity of CVE-2021-41817?

CVE-2021-41817 has a severity rating of 7.5 (high).

3

How does CVE-2021-41817 affect Ruby applications?

CVE-2021-41817 allows an attacker to hang a Ruby application by providing a specially crafted date string.

4

Which versions of the Ruby date gem are affected by CVE-2021-41817?

Versions up to and including 3.2.0 of the Ruby date gem are affected by CVE-2021-41817.

5

How can I fix CVE-2021-41817?

To fix CVE-2021-41817, update the Ruby date gem to version 3.2.1 or later.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203