CVE-2021-23368: Postcss Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-hwj9-h5mp-3pm3
CVSS 5.3
CWE-400
Published
Advisory Summary

CVE-2021-23368 is a MODERATE (CVSS 5.3) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Postcss libraries in the npm ecosystem. The issue involves regular expression denial of service in postcss. Remediation is available by upgrading affected packages to version 7.0.36, 8.2.10.

CVE-2021-23368 at a Glance

CVE Identifier CVE-2021-23368
GHSA Identifier GHSA-hwj9-h5mp-3pm3
Severity MODERATE
CVSS v3.1 Base Score 5.3
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Postcss
Package Ecosystem npm
Published Date
Last Updated

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

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 Low (A:L)

How to Fix CVE-2021-23368

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

postcss fixed: 7.0.36
npm install postcss@7.0.36
postcss fixed: 8.2.10
npm install postcss@8.2.10
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 postcss

How to Check if You Are Affected

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

npm ls postcss

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

Note: The npm ls postcss 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 Postcss, 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 npm package `postcss` from 7.0.0 and before versions 7.0.36 and 8.2.10 is vulnerable to Regular Expression Denial of Service (ReDoS) during source map parsing.

CVE-2021-23368 Affected Postcss Versions

2 component(s)
Fixed Versions:
7.0.368.2.10
Product / Package Ecosystem Affected Versions Fixed Version
postcss
npm
≥ 7.0.0
< 7.0.36
7.0.36
postcss
npm
≥ 8.0.0
< 8.2.10
8.2.10

References

NVD — CVE-2021-23368 NVD
https://nvd.nist.gov/vuln/detail/CVE-2021-23368
Security Fix Commit FIX COMMIT
https://github.com/postcss/postcss/commit/54cbf3c4847eb0fb1501b9d2337465439e849734
Security Fix Commit FIX COMMIT
https://github.com/postcss/postcss/commit/8682b1e4e328432ba692bed52326e84439cec9e4
Security Fix Commit FIX COMMIT
https://github.com/postcss/postcss/commit/b6f3e4d5a8d7504d553267f80384373af3a3dec5
lists.apache.org/thread.html/r00158f... WEB
https://lists.apache.org/thread.html/r00158f5d770d75d0655c5eef1bdbc6150531606c8f8bcb778f0627be@%3Cdev.myfaces.apache.org%3E
lists.apache.org/thread.html/r16e295... WEB
https://lists.apache.org/thread.html/r16e295b4f02d81b79981237d602cb0b9e59709bafaa73ac98be7cef1@%3Cdev.myfaces.apache.org%3E
snyk.io/vuln/snyk-java-orgw... WEB
https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1244795
lists.apache.org/thread.html/r49afb4... WEB
https://lists.apache.org/thread.html/r49afb49b38748897211b1f89c3a64dc27f9049474322b05715695aab@%3Cdev.myfaces.apache.org%3E
lists.apache.org/thread.html/r5acd89... WEB
https://lists.apache.org/thread.html/r5acd89f3827ad9a9cad6d24ed93e377f7114867cd98cfba616c6e013@%3Ccommits.myfaces.apache.org%3E
lists.apache.org/thread.html/r8def97... WEB
https://lists.apache.org/thread.html/r8def971a66cf3e375178fbee752e1b04a812a047cc478ad292007e33@%3Cdev.myfaces.apache.org%3E
lists.apache.org/thread.html/rad5af2... WEB
https://lists.apache.org/thread.html/rad5af2044afb51668b1008b389ac815a28ecea9eb75ae2cab5a00ebb@%3Ccommits.myfaces.apache.org%3E
snyk.io/vuln/snyk-js-postcs... WEB
https://snyk.io/vuln/SNYK-JS-POSTCSS-1090595

Frequently Asked Questions

What is CVE-2021-23368?
CVE-2021-23368 is a security vulnerability in Postcss involving Regular Expression Denial of Service in postcss under CWE-400: Uncontrolled Resource Consumption.
Which Postcss versions are affected?
Affected versions include releases prior to 7.0.36, 8.2.10 across affected packages: postcss.
What version fixes CVE-2021-23368?
Upgrading to 7.0.36, 8.2.10 (or the latest patched release for your respective branch) resolves the vulnerability.
Is postcss affected?
Yes, postcss is affected in releases prior to 7.0.36, 8.2.10. Upgrade your dependency to 7.0.36, 8.2.10 or later.
What is the CVSS score of CVE-2021-23368?
CVE-2021-23368 has a CVSS v3.1 base score of 5.3 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L.
What CWE is associated with CVE-2021-23368?
CVE-2021-23368 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-2021-23368?
Run the dependency tree command: 'npm ls postcss'. 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-hwj9-h5mp-3pm3",
  "modified" : "2021-06-15T15:12:13Z",
  "published" : "2021-05-10T15:29:24Z",
  "aliases" : [ "CVE-2021-23368" ],
  "summary" : "Regular Expression Denial of Service in postcss",
  "details" : "The npm package `postcss` from 7.0.0 and before versions 7.0.36 and 8.2.10 is vulnerable to Regular Expression Denial of Service (ReDoS) during source map parsing.",
  "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" : "postcss"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.0.36"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "postcss"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.2.10"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-23368"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss/commit/54cbf3c4847eb0fb1501b9d2337465439e849734"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss/commit/8682b1e4e328432ba692bed52326e84439cec9e4"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss/commit/b6f3e4d5a8d7504d553267f80384373af3a3dec5"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r00158f5d770d75d0655c5eef1bdbc6150531606c8f8bcb778f0627be@%3Cdev.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r16e295b4f02d81b79981237d602cb0b9e59709bafaa73ac98be7cef1@%3Cdev.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r49afb49b38748897211b1f89c3a64dc27f9049474322b05715695aab@%3Cdev.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r5acd89f3827ad9a9cad6d24ed93e377f7114867cd98cfba616c6e013@%3Ccommits.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/r8def971a66cf3e375178fbee752e1b04a812a047cc478ad292007e33@%3Cdev.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread.html/rad5af2044afb51668b1008b389ac815a28ecea9eb75ae2cab5a00ebb@%3Ccommits.myfaces.apache.org%3E"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JAVA-ORGWEBJARSNPM-1244795"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-POSTCSS-1090595"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-07T17:26:38Z",
    "nvd_published_at" : "2021-04-12T14:15:00Z"
  }
}