GHSA-qg54-694p-wgpp

Suggest an improvement
Source
https://github.com/advisories/GHSA-qg54-694p-wgpp
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2021/11/GHSA-qg54-694p-wgpp/GHSA-qg54-694p-wgpp.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-qg54-694p-wgpp
Aliases
Published
2021-11-16T00:32:30Z
Modified
2024-02-21T05:31:58.915876Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
Regular expression denial of service vulnerability (ReDoS) in date
Details

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

Date.strptime('2001-02-20', '%Y-%m-%d')
Database specific
{
    "nvd_published_at": "2022-01-01T05:15:00Z",
    "cwe_ids": [
        "CWE-1333"
    ],
    "severity": "HIGH",
    "github_reviewed": true,
    "github_reviewed_at": "2021-11-16T00:15:43Z"
}
References

Affected packages

RubyGems / date

Package

Name
date
Purl
pkg:gem/date

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.2.0
Fixed
3.2.1

Affected versions

3.*

3.2.0

RubyGems / date

Package

Name
date
Purl
pkg:gem/date

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.1.0
Fixed
3.1.2

Affected versions

3.*

3.1.0
3.1.1

RubyGems / date

Package

Name
date
Purl
pkg:gem/date

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.0.0
Fixed
3.0.2

Affected versions

3.*

3.0.0
3.0.1

RubyGems / date

Package

Name
date
Purl
pkg:gem/date

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.0.1

Affected versions

0.*

0.0.1

1.*

1.0.0

2.*

2.0.0