Advisory

GHSA-qg54-694p-wgpp

Also known as: BIT-ruby-2021-41817, BIT-ruby-min-2021-41817, CVE-2021-41817

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')

Severity

High Basis: The source's own band: HIGH

Dates

Published
2021-11-16 00:32 UTC
Modified
2025-01-27 08:58 UTC

Affected packages and fixes

date

RubyGems · All systems

Affected

  • introduced 3.2.0, fixed 3.2.1 (ecosystem)

Fixed versions

3.2.1

Fix

The export has no generic command for this ecosystem.

date

RubyGems · All systems

Affected

  • introduced 3.1.0, fixed 3.1.2 (ecosystem)

Fixed versions

3.1.2

Fix

The export has no generic command for this ecosystem.

date

RubyGems · All systems

Affected

  • introduced 3.0.0, fixed 3.0.2 (ecosystem)

Fixed versions

3.0.2

Fix

The export has no generic command for this ecosystem.

date

RubyGems · All systems

Affected

  • introduced 0, fixed 2.0.1 (ecosystem)

Fixed versions

2.0.1

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences