Vulnerabilities in pkg:npm/css-what

PACKAGE
Advisory Identifier: GHSA-p28h-cc7q-c4fg
Advisory Summary

CVE-2022-21222 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Css what libraries in the npm ecosystem. The issue involves css-what vulnerable to redos due to use of insecure regular expression. Remediation is available by upgrading affected packages to version 2.1.3.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/css-what

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/css-what. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-p28h-cc7q-c4fg CVE-2022-21222 HIGH css-what vulnerable to ReDoS due to use of insecure regular expression
GHSA-q8pj-2vqx-8ggc CVE-2021-33587 HIGH Denial of service in css-what

CVE-2022-21222 at a Glance

CVE Identifier CVE-2022-21222
GHSA Identifier GHSA-p28h-cc7q-c4fg
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Css what
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-2022-21222

To remediate this vulnerability, upgrade all affected Css what dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

css-what fixed: 2.1.3
npm install css-what@2.1.3
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 css-what

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-21222, inspect your project dependencies using npm:

npm ls css-what

Analyze the terminal output to locate any version of Css what in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.3), your application is affected.

Note: The npm ls css-what 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-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Css what, 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 css-what before 2.1.3 is vulnerable to Regular Expression Denial of Service (ReDoS) due to the use of insecure regular expression in the `re_attr` variable of index.js. The exploitation of this vulnerability could be triggered via the parse function.

CVE-2022-21222 Affected Css what Versions

1 component(s)
Fixed Versions:
2.1.3
Product / Package Ecosystem Affected Versions Fixed Version
css-what
npm
< 2.1.3
2.1.3

References

Frequently Asked Questions

What is CVE-2022-21222?
CVE-2022-21222 is a security vulnerability in Css what involving css-what vulnerable to ReDoS due to use of insecure regular expression under CWE-400: Uncontrolled Resource Consumption.
Which Css what versions are affected?
Affected versions include releases prior to 2.1.3 across affected packages: css-what.
What version fixes CVE-2022-21222?
Upgrading to 2.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is css-what affected?
Yes, css-what is affected in releases prior to 2.1.3. Upgrade your dependency to 2.1.3 or later.
What is the CVSS score of CVE-2022-21222?
CVE-2022-21222 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-2022-21222?
CVE-2022-21222 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check npm dependencies for CVE-2022-21222?
Run the dependency tree command: 'npm ls css-what'. 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-p28h-cc7q-c4fg",
  "modified" : "2025-05-20T21:02:33Z",
  "published" : "2022-10-01T00:00:24Z",
  "aliases" : [ "CVE-2022-21222" ],
  "summary" : "css-what vulnerable to ReDoS due to use of insecure regular expression",
  "details" : "The package css-what before 2.1.3 is vulnerable to Regular Expression Denial of Service (ReDoS) due to the use of insecure regular expression in the `re_attr` variable of index.js. The exploitation of this vulnerability could be triggered via the parse function.",
  "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" : "css-what"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-21222"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fb55/css-what/commit/dc510929790da6617e7aa93a616498b22f6a6b72"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/fb55/css-what"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fb55/css-what/blob/a38effd5a8f5506d75c7f8f13cbd8c76248a3860/index.js#23L12"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/fb55/css-what/blob/a38effd5a8f5506d75c7f8f13cbd8c76248a3860/index.js%23L12"
  }, {
    "type" : "WEB",
    "url" : "https://lists.debian.org/debian-lts-announce/2023/03/msg00001.html"
  }, {
    "type" : "WEB",
    "url" : "https://security.snyk.io/vuln/SNYK-JS-CSSWHAT-3035488"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1333", "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-10-04T21:11:32Z",
    "nvd_published_at" : "2022-09-30T05:15:00Z"
  }
}