Skip to content

Regular Expression Denial of Service (ReDOS)

Moderate severity GitHub Reviewed Published Jun 22, 2021 to the GitHub Advisory Database • Updated Feb 1, 2023

Package

npm color-string (npm)

Affected versions

< 1.5.5

Patched versions

1.5.5

Description

In the npm package color-string, there is a ReDos (Regular Expression Denial of Service) vulnerability regarding an exponential time complexity for
linearly increasing input lengths for hwb() color strings.

Strings reaching more than 5000 characters would see several
milliseconds of processing time; strings reaching more than
50,000 characters began seeing 1500ms (1.5s) of processing time.

The cause was due to a the regular expression that parses
hwb() strings - specifically, the hue value - where
the integer portion of the hue value used a 0-or-more quantifier
shortly thereafter followed by a 1-or-more quantifier.

This caused excessive backtracking and a cartesian scan,
resulting in exponential time complexity given a linear
increase in input length.

References

Published by the National Vulnerability Database Jun 21, 2021
Reviewed Jun 21, 2021
Published to the GitHub Advisory Database Jun 22, 2021
Last updated Feb 1, 2023

Severity

Moderate
5.3
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L

Weaknesses

CVE ID

CVE-2021-29060

GHSA ID

GHSA-257v-vj4p-3w2h

Source code

No known source code
Loading Checking history
See something to contribute? Suggest improvements for this vulnerability.