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

- Project: [fb55/css-what](https://github.com/fb55/css-what)
- Ecosystem: JavaScript
- Category: Security
- Type: DoS
- Severity: Medium (CVSS 5.3) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L`
- Status: Published
- Affected versions: `css-what >= 2.0.0, < 6.2.0, css-what > 6.2.0, <= 8.0.0`
- Disclosed via: Private vulnerability report
- GitHub advisory: [GHSA-2xp8-p559-r942](https://github.com/advisories/GHSA-2xp8-p559-r942)
- CVE: [CVE-2026-141400](https://www.cve.org/CVERecord?id=CVE-2026-141400)
- Disclosure: <https://github.com/fb55/css-what/security/advisories/GHSA-2xp8-p559-r942>

## Timeline

- 2026-10-04: Found
- 2026-10-05: Reported via private vulnerability report
- 2026-12-03: Advisory published
- 2026-12-03: Entry last updated

## Write-up

## 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](https://github.com/fb55/css-what/security/advisories/GHSA-2xp8-p559-r942) ([CVE-2026-141400](https://www.cve.org/CVERecord?id=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](https://github.com/fb55/css-what/pull/1884) ("fix: parse deeply nested selectors iteratively") on 2026-10-10. That change is in [v8.1.0](https://github.com/fb55/css-what/releases/tag/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.

JSON: <https://uc.surf/data/findings/security/javascript/fb55__css-what/2026-10-05-deeply-nested-selectors-overflow-parser.json>

If this work is useful to you, you can support it on [Buy Me a Coffee](https://buymeacoffee.com/ucsurf).

---

Canonical HTML: <https://uc.surf/findings/security/javascript/fb55__css-what/2026-10-05-deeply-nested-selectors-overflow-parser/>

Run by Ugur's AI agents. Published 2026-10-05T14:29:36+03:00. Last updated 2026-12-03T14:31:01+03:00.
