CVE-2026-104844: PostCSS Quadratic Complexity Vulnerability

MODERATE
Advisory Identifier: GHSA-rj75-hqrm-r3gf
CVSS 5.9
CWE-400 CWE-407
Published
Advisory Summary

CVE-2026-104844 is a MODERATE (CVSS 5.9) quadratic complexity vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting PostCSS libraries in the npm ecosystem. The issue involves quadratic complexity in flat selector parsing allows cpu exhaustion. Remediation is available by upgrading affected packages to version 7.1.6.

CVE-2026-104844 at a Glance

CVE Identifier CVE-2026-104844
GHSA Identifier GHSA-rj75-hqrm-r3gf
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product PostCSS
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
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-2026-104844

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-selector-parser fixed: 7.1.6
npm install postcss-selector-parser@7.1.6
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-selector-parser

How to Check if You Are Affected

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

npm ls postcss-selector-parser

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.1.6), your application is affected.

Note: The npm ls postcss-selector-parser 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

### Impact `.` and `#` are not word delimiters in the tokenizer, so a flat selector such as `.a.a.a...` reaches `splitWord()` as a single word token carrying n class or id indexes. Three passes scanned those index arrays linearly for every index, making the parse O(n^2) in the number of indexes rather than in input length: `uniqs()`, the `indices.forEach` loop, and the Sass-interpolation filter. Parsing a 400 KB flat selector took ~34 s on a modern laptop, fully occupying a single thread. A benign selector of identical byte size parses in tens of milliseconds, so the cost is driven by the index count, not the input size. The nesting depth of such a selector is 0, so the `maxNestingDepth` guard added in 7.1.3 offers no protection. Reachability is deployment dependent. Only consumers that parse untrusted, attacker-supplied selectors synchronously in a request path are exposed, for example CSS sanitizers, CSS-in-JS services and online playgrounds. Ordinary build-time use on trusted sources is not affected. ### Patches Fixed in 7.1.6. The three passes now use Set membership tests, making parsing linear in the number of indexes. There is no behaviour change: parsing is byte-identical on a differential corpus of 8413 selectors. ### Workarounds Cap the size of selectors accepted from untrusted sources before parsing.

CVE-2026-104844 Affected PostCSS Versions

1 component(s)
Fixed Versions:
7.1.6
Product / Package Ecosystem Affected Versions Fixed Version
postcss-selector-parser
npm
< 7.1.6
7.1.6

References

Frequently Asked Questions

What is CVE-2026-104844?
CVE-2026-104844 is a security vulnerability in PostCSS involving Quadratic complexity in flat selector parsing allows CPU exhaustion under CWE-400: Uncontrolled Resource Consumption.
Which PostCSS versions are affected?
Affected versions include releases prior to 7.1.6 across affected packages: postcss-selector-parser.
What version fixes CVE-2026-104844?
Upgrading to 7.1.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is postcss-selector-parser affected?
Yes, postcss-selector-parser is affected in releases prior to 7.1.6. Upgrade your dependency to 7.1.6 or later.
What is the CVSS score of CVE-2026-104844?
CVE-2026-104844 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-104844?
CVE-2026-104844 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-2026-104844?
Run the dependency tree command: 'npm ls postcss-selector-parser'. 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-rj75-hqrm-r3gf",
  "modified" : "2026-10-05T22:53:54Z",
  "published" : "2026-10-05T22:53:54Z",
  "aliases" : [ "CVE-2026-104844" ],
  "summary" : "PostCSS: Quadratic complexity in flat selector parsing allows CPU exhaustion",
  "details" : "### Impact\n\n`.` and `#` are not word delimiters in the tokenizer, so a flat selector such as\n`.a.a.a...` reaches `splitWord()` as a single word token carrying n class or id\nindexes. Three passes scanned those index arrays linearly for every index,\nmaking the parse O(n^2) in the number of indexes rather than in input length:\n`uniqs()`, the `indices.forEach` loop, and the Sass-interpolation filter.\nParsing a 400 KB flat selector took ~34 s on a modern laptop, fully occupying a\nsingle thread. A benign selector of identical byte size parses in tens of\nmilliseconds, so the cost is driven by the index count, not the input size.\nThe nesting depth of such a selector is 0, so the `maxNestingDepth` guard added\nin 7.1.3 offers no protection.\n\nReachability is deployment dependent. Only consumers that parse untrusted,\nattacker-supplied selectors synchronously in a request path are exposed, for\nexample CSS sanitizers, CSS-in-JS services and online playgrounds. Ordinary\nbuild-time use on trusted sources is not affected.\n\n### Patches\n\nFixed in 7.1.6. The three passes now use Set membership tests, making parsing\nlinear in the number of indexes. There is no behaviour change: parsing is\nbyte-identical on a differential corpus of 8413 selectors.\n\n### Workarounds\n\nCap the size of selectors accepted from untrusted sources before parsing.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "postcss-selector-parser"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "7.1.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss-selector-parser/security/advisories/GHSA-rj75-hqrm-r3gf"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-104844"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss-selector-parser/commit/62b191792df0a0bc56062e5a875bc74aae2a51cd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/postcss/postcss-selector-parser"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/postcss/postcss-selector-parser/releases/tag/7.1.6"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-407" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-05T22:53:54Z",
    "nvd_published_at" : "2026-10-02T16:16:46Z"
  }
}