Vulnerabilities in pkg:npm/colors
PACKAGECVE-2021-23567 is a HIGH (CVSS 7.5) infinite loop vulnerability (CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')) affecting Colors libraries in the npm ecosystem. The issue involves infinite loop in colors.js. Remediation is available in the latest vendor maintenance releases.
pkg:npm/colors
Vulnerability advisories affecting package pkg:npm/colors. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-gh88-3pxp-6fm8 | CVE-2021-23567 | HIGH | Infinite Loop in colors.js |
| GHSA-5rqg-jm4f-cqx7 | - | HIGH | Infinite loop causing Denial of Service in colors |
CVE-2021-23567 at a Glance
Security Impact
CVSS: 7.5
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:H).
How to Fix CVE-2021-23567
To remediate this vulnerability, upgrade all affected Colors 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 colors@Latest secure release
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls colors
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-23567, inspect your project dependencies using npm:
npm ls colors
Analyze the terminal output to locate any version of Colors in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.
Note: The npm ls colors 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-835: Loop with Unreachable Exit Condition ('Infinite Loop'), where the product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. In Colors, 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-23567 Affected Colors Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
colors
|
npm |
≥ 1.4.1
|
|
References
Frequently Asked Questions
What is CVE-2021-23567?
Which Colors versions are affected?
What version fixes CVE-2021-23567?
Is colors affected?
What is the CVSS score of CVE-2021-23567?
What CWE is associated with CVE-2021-23567?
How can I check npm dependencies for CVE-2021-23567?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gh88-3pxp-6fm8",
"modified" : "2022-01-21T21:04:45Z",
"published" : "2022-01-21T23:39:50Z",
"aliases" : [ "CVE-2021-23567" ],
"summary" : "Infinite Loop in colors.js",
"details" : "The package colors after 1.4.0 are vulnerable to Denial of Service (DoS) that was introduced through an infinite loop in the americanFlag module. Unfortunately this appears to have been a purposeful attempt by a maintainer of colors to make the package unusable, other maintainers' controls over this package appear to have been revoked in an attempt to prevent them from fixing the issue. Vulnerable Code js for (let i = 666; i < Infinity; i++;) { Alternative Remediation Suggested * Pin dependancy to 1.4.0",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "colors"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.4.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23567"
}, {
"type" : "WEB",
"url" : "https://github.com/Marak/colors.js/issues/285"
}, {
"type" : "WEB",
"url" : "https://github.com/Marak/colors.js/issues/285%23issuecomment-1008212640"
}, {
"type" : "WEB",
"url" : "https://github.com/Marak/colors.js/commit/074a0f8ed0c31c35d13d28632bd8a049ff136fb6%23diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1R18"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/Marak/colors.js"
}, {
"type" : "WEB",
"url" : "https://snyk.io/blog/open-source-maintainer-pulls-the-plug-on-npm-packages-colors-and-faker-now-what"
}, {
"type" : "WEB",
"url" : "https://snyk.io/vuln/SNYK-JS-COLORS-2331906"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-835" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2022-01-21T21:04:45Z",
"nvd_published_at" : "2022-01-14T20:15:00Z"
}
}