CVE-2021-29060: Color string Denial of Service Vulnerability
MODERATECVE-2021-29060 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-770: Allocation of Resources Without Limits or Throttling) affecting Color string libraries in the npm ecosystem. The issue involves regular expression denial of service (redos). Remediation is available by upgrading affected packages to version 1.5.5.
CVE-2021-29060 at a Glance
Security Impact
CVSS: 5.3
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L).
How to Fix CVE-2021-29060
To remediate this vulnerability, upgrade all affected Color string dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install color-string@1.5.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls color-string
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-29060, inspect your project dependencies using npm:
npm ls color-string
Analyze the terminal output to locate any version of Color string in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.5), your application is affected.
Note: The npm ls color-string command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-770: Allocation of Resources Without Limits or Throttling, where the product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated. In Color string, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2021-29060 Affected Color string Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
color-string
|
npm |
< 1.5.5
|
1.5.5
|
References
Frequently Asked Questions
What is CVE-2021-29060?
Which Color string versions are affected?
What version fixes CVE-2021-29060?
Is color-string affected?
What is the CVSS score of CVE-2021-29060?
What CWE is associated with CVE-2021-29060?
How can I check npm dependencies for CVE-2021-29060?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-257v-vj4p-3w2h",
"modified" : "2021-06-30T18:03:29Z",
"published" : "2021-06-22T01:14:09Z",
"aliases" : [ "CVE-2021-29060" ],
"summary" : "Regular Expression Denial of Service (ReDOS)",
"details" : "In the npm package `color-string`, there is a ReDos (Regular Expression Denial of Service) vulnerability regarding an exponential time complexity for\nlinearly increasing input lengths for `hwb()` color strings.\n\nStrings reaching more than 5000 characters would see several\nmilliseconds of processing time; strings reaching more than\n50,000 characters began seeing 1500ms (1.5s) of processing time.\n\nThe cause was due to a the regular expression that parses\nhwb() strings - specifically, the hue value - where\nthe integer portion of the hue value used a 0-or-more quantifier\nshortly thereafter followed by a 1-or-more quantifier.\n\nThis caused excessive backtracking and a cartesian scan,\nresulting in exponential time complexity given a linear\nincrease in input length.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "color-string"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.5.5"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29060"
}, {
"type" : "WEB",
"url" : "https://github.com/Qix-/color-string/commit/0789e21284c33d89ebc4ab4ca6f759b9375ac9d3"
}, {
"type" : "WEB",
"url" : "https://github.com/Qix-/color-string/releases/tag/1.5.5"
}, {
"type" : "WEB",
"url" : "https://github.com/yetingli/PoCs/blob/main/CVE-2021-29060/Color-String.md"
}, {
"type" : "WEB",
"url" : "https://github.com/yetingli/SaveResults/blob/main/js/color-string.js"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/color-string"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-770" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-21T23:20:37Z",
"nvd_published_at" : "2021-06-21T16:15:00Z"
}
}