soupsieve@4.0

A modern CSS selector implementation for Beautiful Soup.

  • latest version

    4.1.2

  • latest non vulnerable version

  • first published

    7 years ago

  • latest version published

    16 hours ago

  • licenses detected

  • Direct Vulnerabilities

    Known vulnerabilities in the soupsieve package. This does not include vulnerabilities belonging to this package’s dependencies.

    Fix vulnerabilities automatically

    Snyk's AI Trust Platform automatically finds the best upgrade path and integrates with your development workflows. Secure your code at zero cost.

    Fix for free
    VulnerabilityVulnerable Version
    • M
    Inefficient Algorithmic Complexity

    Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via the :has() CSS pseudo-class selector in css_match.py, which causes quadratic-time matching when processing deeply nested or wide HTML/XML documents. When :has() is used with a descendant relative selector (e.g. div:has(p)), the library repeatedly searches each candidate element's entire subtree without reusing results, producing O(n²) time complexity relative to nesting depth. When :has() appears on the parent side of a child combinator (e.g. div:has(> p) > span), the parent is re-evaluated once per child rather than once total, producing O(n²) time complexity relative to the number of children. An attacker who controls the parsed HTML or XML can send a small document that occupies a worker for seconds to minutes.

    Note: This is only exploitable when selectors are run against attacker-controlled documents. Selectors compiled with the NOCACHE flag continue to use the old uncached behavior and remain vulnerable even after upgrading.

    How to fix Inefficient Algorithmic Complexity?

    Upgrade soupsieve to version 4.0.1 or higher.

    [,4.0.1)