Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2026-104844 Overview
CVE-2026-104844 is a denial of service vulnerability in postcss-selector-parser, a CSS selector parser used across the PostCSS ecosystem and many front-end build tools. Versions prior to 7.1.6 contain a quadratic-complexity flaw in src/parser.js that allows a crafted selector to monopolize a synchronous parser thread. The vulnerability is classified as uncontrolled resource consumption [CWE-400].
Only consumers that synchronously parse untrusted selectors in an exposed request path are affected. Ordinary build-time parsing of trusted CSS sources is not impacted. The maintainers released a fix in version 7.1.6.
Critical Impact
A crafted CSS selector can trigger quadratic parsing behavior, exhausting CPU on any service that parses attacker-controlled selectors in a synchronous request path.
Affected Products
- postcss-selector-parser versions prior to 7.1.6
- Server-side applications and APIs that parse untrusted CSS selectors synchronously
- Downstream tools and frameworks embedding postcss-selector-parser in request-handling paths
Discovery Timeline
- 2026-10-02 - CVE-2026-104844 published to the National Vulnerability Database (NVD)
- 2026-10-02 - Last updated in NVD database
Technical Details for CVE-2026-104844
Vulnerability Analysis
The flaw resides in the splitWord() function inside src/parser.js. The tokenizer does not treat the period (.) and hash (#) characters as word delimiters, so a flat selector arrives at splitWord() as a single word token carrying many class and ID indexes. The parser then runs several passes over those indexes.
The uniqs() helper deduplicates the index arrays using Array.prototype.filter combined with indexOf, which performs a linear scan for every element. Per-index class and ID membership checks repeat similar linear scans. A separate Sass-interpolation filtering pass also rescans the same arrays. Together, these passes drive parsing time to O(n²) in the number of indexes.
The existing maxNestingDepth guard does not help, because a hostile selector can be fully flat with zero nesting depth. A single long selector such as .a.a.a… with tens of thousands of class indexes blocks the Node.js event loop while the parser executes synchronously.
Root Cause
The root cause is an algorithmic complexity defect. Deduplication and membership checks implemented with indexOf on growing arrays scale quadratically, and no input-size cap exists on the number of class or ID indexes a single selector can carry.
Attack Vector
An attacker submits a crafted selector string, for example through an HTTP request to an endpoint that passes the value into postcss-selector-parser synchronously. The parser consumes CPU proportional to the square of the number of indexes, stalling the worker thread and degrading or halting the service for other requests.
// Patch excerpt from src/parser.js (v7.1.6)
// Replaces O(n^2) filter+indexOf deduplication with an O(n) Set-based pass.
function uniqs() {
// A Set keeps the first-occurrence order the previous filter/indexOf pass
// produced, without its quadratic cost on long index lists.
return Array.from(new Set(Array.prototype.concat.apply([], arguments)));
}
export default class Parser {
Source: postcss-selector-parser commit 62b1917
Detection Methods for CVE-2026-104844
Indicators of Compromise
- Sustained single-core CPU saturation in Node.js worker processes correlated with inbound requests carrying CSS selector payloads.
- HTTP request bodies or query parameters containing unusually long selectors with repeated . or # sequences such as .a.a.a… or #a#a#a….
- Event-loop lag alerts or request-timeout spikes on endpoints that accept user-supplied styling or theming data.
Detection Strategies
- Inventory services using postcss-selector-parser with npm ls postcss-selector-parser and flag any version earlier than 7.1.6.
- Instrument parser call sites with execution-time metrics to surface selectors exceeding a configurable threshold, for example 50 ms.
- Review web application firewall (WAF) logs for request parameters containing hundreds or thousands of period or hash characters in a single token.
Monitoring Recommendations
- Monitor process-level CPU and event-loop latency on Node.js services that handle untrusted CSS or selector input.
- Alert on repeated 5xx or gateway-timeout responses from endpoints that accept styling payloads.
- Track application dependency graphs for transitive upgrades of postcss-selector-parser to confirm 7.1.6 is reached across the environment.
How to Mitigate CVE-2026-104844
Immediate Actions Required
- Upgrade postcss-selector-parser to version 7.1.6 or later in all production dependencies, including transitive ones.
- Audit application code to identify any synchronous parsing of attacker-controlled selectors in request paths.
- Add request-size and execution-time limits around parser invocations until the upgrade is deployed.
Patch Information
The fix lands in version 7.1.6 and replaces the quadratic filter/indexOf deduplication in uniqs() with a linear Set-based implementation. See the GitHub Security Advisory GHSA-rj75-hqrm-r3gf, the v7.1.6 release notes, and the upstream commit.
Workarounds
- Reject selector inputs above a conservative length limit, for example 1,024 characters, before passing them to the parser.
- Move selector parsing out of synchronous request paths into isolated worker threads with hard CPU timeouts.
- Apply WAF rules to block request parameters containing excessive repetitions of . or # characters.
# Upgrade to the patched release and verify the resolved version
npm install postcss-selector-parser@^7.1.6
npm ls postcss-selector-parser
# For transitive dependencies, pin the fixed version using npm overrides
# (in package.json):
# "overrides": {
# "postcss-selector-parser": "^7.1.6"
# }
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

