---
id: "CVE-2026-126189"
page: "https://infrastack.ai/live/CVE-2026-126189"
kind: "vulnerability"
aliases: ["CVE-2026-126189"]
title: "Soup Sieve: quadratic :has() matching lets crafted HTML stall a worker"
severity: "medium"
cvss: 5.3
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["beautifulsoup", "package", "python", "soupsieve", "web-scraping"]
not_affected_if: ["no-has-selectors", "trusted-documents-only"]
published_at: "2026-11-12T17:17:32+00:00"
first_seen_at: "2026-11-12T17:39:37+00:00"
updated_at: "2026-11-12T17:40:12+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-126189", "first_seen_at": "2026-11-12T17:39:37+00:00"}]
exploit_sources: []
---

# Soup Sieve: quadratic :has() matching lets crafted HTML stall a worker

Link for people: https://infrastack.ai/live/CVE-2026-126189 (this .md is for agents)

Soup Sieve is a CSS selector library used with Beautiful Soup 4. Before 4.0.1, evaluating :has() selectors against deeply nested or wide untrusted HTML or XML takes quadratic time, so an attacker can keep a worker busy for seconds or minutes.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed version with `pip show soupsieve`.
- Search dependencies for `soupsieve` or `beautifulsoup4` to find where it is pulled in.
- Look for code that calls select(), select_one() or CSS APIs with :has() on documents from users or other untrusted sources.

## Fix

- soupsieve: `4.0.1`

## Timeline

- 2026-11-12T17:39:37+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-126189

## Documents

- [advisory] Vendor advisory: github.com https://github.com/facelessuser/soupsieve/security/advisories/GHSA-8jvp-3x96-xpqw
- [fix] Patch: github.com https://github.com/facelessuser/soupsieve/commit/0469c148f5501ec2127e0d65b77c2a1c395fa379
- [fix] Patch: github.com https://github.com/facelessuser/soupsieve/commit/305fbf6b8c1f6ff05fec55d1e5bb28d80d22de44
- [fix] Release notes: github.com https://github.com/facelessuser/soupsieve/releases/tag/4.0.1

## From the sources

Soup Sieve is a CSS selector library designed to be used with Beautiful Soup 4. Prior to 4.0.1, Soup Sieve repeatedly searches descendant subtrees for each candidate evaluated by :has() and repeatedly reevaluates a parent containing :has(> ...) for each child, causing quadratic matching on deeply nested or wide attacker-influenced HTML or XML. Applications using ordinary fixed selectors through select(), select_one(), or Beautiful Soup CSS APIs against untrusted documents can have a worker occupied for seconds or minutes, while applications that process only trusted documents are not affected. Selectors compiled with NOCACHE continue to use the old uncached behavior. This issue is fixed in version 4.0.1.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
