Vulnerabilities in pkg:npm/colors

PACKAGE
Advisory Identifier: GHSA-gh88-3pxp-6fm8
Advisory Summary

CVE-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.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/colors

2 Known Advisory Record(s)

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

CVE Identifier CVE-2021-23567
GHSA Identifier GHSA-gh88-3pxp-6fm8
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop')
Affected Product Colors
Package Ecosystem npm
Published Date
Last Updated

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

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (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.

colors fixed: Latest secure release
npm install colors@Latest secure release
Verify Direct and Transitive Dependencies

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

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

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?
CVE-2021-23567 is a security vulnerability in Colors involving Infinite Loop in colors.js under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop').
Which Colors versions are affected?
Affected versions include releases prior to current release patches across affected packages: colors.
What version fixes CVE-2021-23567?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is colors affected?
Yes, colors is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2021-23567?
CVE-2021-23567 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2021-23567?
CVE-2021-23567 is classified under CWE-835: Loop with Unreachable Exit Condition ('Infinite Loop') (The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop.).
How can I check npm dependencies for CVE-2021-23567?
Run the dependency tree command: 'npm ls colors'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}