JavaScriptSeverity: MediumStatus: Published

Deeply nested selectors overflow the parser call stack

Applications that pass untrusted selectors to css-what’s parse() are affected (CWE-674). parse() handled each nested selector-valued pseudo-class, such as :is(), :not(), :has() or :where(), with a recursive call, so a selector nested a few thousand levels deep exhausts the JavaScript call stack and makes parse() throw a RangeError. npm package css-what versions >= 2.0.0 and <= 8.0.0 are affected, except the empty 6.2.0 package. 1.0.0 keeps nested selector arguments as strings and is not affected. Fixed in 8.1.0. This is CVE-2026-141400. GitHub rates it medium, with CVSS 3.1 score 5.3. The advisory credits ucsurf, Linus-Shyu, iaohkut-from-NightWolf-Team and uug4na as reporters. Fixed by Felix Boehm (@fb55).

Impact

Applications that pass untrusted selectors to css-what’s parse() are affected. parse() handled each nested selector-valued pseudo-class, such as :is(), :not(), :has() or :where(), with a recursive call (CWE-674). A selector nested a few thousand levels deep exhausts the JavaScript call stack and makes parse() throw a RangeError. If the application does not catch the error, it can fail the request or terminate the process.

Affected versions and fix

The npm package css-what is affected in versions >= 2.0.0 and <= 8.0.0, except the empty 6.2.0 package. Version 1.0.0 keeps nested selector arguments as strings and is not affected. The patched release is 8.1.0.

The published advisory is GHSA-2xp8-p559-r942 (CVE-2026-141400). GitHub rates it medium, with CVSS 3.1 score 5.3 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L). Felix Boehm (@fb55) published the advisory on 2026-12-03. It was reported on 2026-10-05 through GitHub private vulnerability reporting, as part of the same report as the css-what selector advisory. The advisory credits ucsurf, Linus-Shyu, iaohkut-from-NightWolf-Team and uug4na as reporters.

The advisory says this was fixed in 8.1.0. On the repository, Felix Boehm merged pull request 1884 (“fix: parse deeply nested selectors iteratively”) on 2026-10-10. That change is in v8.1.0. The pull request is not ours.

The advisory suggests catching errors thrown by parse(), and rejecting untrusted selectors that are longer or more deeply nested than the application needs, if an upgrade is not possible yet.

Timeline

  1. Found
  2. Reported via private vulnerability report
  3. Advisory published
  4. Entry last updated

Machine-readable: JSON · Markdown · ID security/javascript/fb55__css-what/2026-10-05-deeply-nested-selectors-overflow-parser

If this work is useful to you, you can support it on Buy Me a Coffee.