Vulnerability GHSA-rj75-hqrm-r3gf

Medium Risk
MEDIUM RISK
CVSS Score: 5.9
Score Range: 4.0–6.9
Medium severity vulnerabilities (CVSS 4.0–6.9). Important issues that meaningfully reduce security confidence.
8 hours ago
October 05, 2026 at 10:53 PM UTC
PostCSS: Quadratic complexity in flat selector parsing allows CPU exhaustion
0.0.1 - 7.1.5
0.0.1 - 7.1.5

Summary

PostCSS: Quadratic complexity in flat selector parsing allows CPU exhaustion

Details

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.

Impacted packages

Timeline

Published
8 hours ago
October 05, 2026 at 10:53 PM UTC
Fixed (7.1.6)
1 month ago
September 03, 2026 at 08:59 AM UTC
Last Modified
8 hours ago
October 05, 2026 at 11:00 PM UTC