All vulnerabilities

npm

CVE-2026-104844

PostCSS: Quadratic complexity in flat selector parsing allows CPU exhaustion

Severity
Medium 5.9
Published
5 Oct 2026
Last changed
26 Oct 2026
Added to UpHeron
22 Oct 2026
Fixed in
6.1.5, 7.1.6
Exploit chance
0.4% in the next 30 daysHigher than 33% of CVEs. EPSS by FIRST, 19 Nov 2026
Weakness
Uncontrolled resource consumption (CWE-400)Inefficient algorithmic complexity (CWE-407)
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Take it down
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Also known as
GHSA-rj75-hqrm-r3gf
Sources
OSV.dev and GitHub

Description

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

From the GitHub Advisory Database, CC BY 4.0.

Workarounds

Cap the size of selectors accepted from untrusted sources before parsing.

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
postcss-selector-parsernpm · osv:npm:postcss-selector-parser
  • Every version before 6.1.5
  • From 7.0.0 before 7.1.6

About postcss-selector-parser

Weekly downloads (npm)
186,017,770npm, 17 Nov 2026

Vulnerabilities in postcss-selector-parser

In our list
2
Published in the last 12 months
2
Critical, last 12 months
0
High, last 12 months
0
Known exploited
0
Search the list for postcss-selector-parser

References