llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · soupsieve

GHSA-CRC3-R666-FWC8

`:lang()` checks every value of its list against every element

Sin parche publicado
Descargar PNG JSON
CVSS 3.1
3.7
Baja
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición20 hDesde la divulgación, 20 nov 2026, 7:58 a. m.
Detección6 minDesde la divulgación hasta su ingreso al índice
Decisión estimadaSeguir
Remediar en la ventana regular de mantenimiento
Estimación de Llama con el árbol SSVC de CISA a partir de vector CVSS 3.1 y la evidencia de explotación (sin evaluación oficial): sin explotación conocida, no automatizable e impacto técnico parcial. No hay versión corregida: aplique mitigaciones.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
07:58 a. m.
08:04 a. m.
04:00 a. m.
07:58 a. m.
12:58 p. m.
05:59 p. m.
10:59 p. m.
04:00 a. m.
FechaFaseEventoDetalle
Divulgación Publicada GHSA-CRC3-R666-FWC8 divulgada · CVSS 3.7 (GitHub)
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Summary

`:lang()` accepts a comma-separated list of language ranges. Soup Sieve checks an element's language against every
value in the list, without stopping when one matches. It also checks the list again for every element, even when many
elements share the same language. A single `:lang()` with thousands of values therefore costs time proportional to the
number of values times the number of elements.

Soup Sieve does not limit the length of a selector string. `max_selectors` limits the number of selectors, and a
`:lang()` list is one selector however many values it has. So an application that compiles untrusted selectors and
relies on `max_selectors` to bound them does not bound this cost.

Details

For each element, `match_lang()` resolves the element's language, then calls `extended_language_filter()` for every
value of every `:lang()` list in the selector. Nothing records the result for that language, and the loop over values
does not end at the first match. So 7,500 values on 1,000 elements make 7,500,000 comparisons, even when every element
has the same language or none.

The cost is linear in the length of the selector and in the size of the document. It does not grow faster than either.
Any selector costs more as it gets longer, but a list of `:lang()` values is the cheapest way to make a selector cost
more per byte.

`max_selectors` counts the selectors in a selector list and the parts of compound and complex selectors. It does not
count the values in the argument of a pseudo-class, and it is not a limit on the length of the selector string.

Soup Sieve does not limit the length of selector strings, and does not guarantee protection against long ones. The
time to match grows with the length of the selector, whatever the selector is made of, and no option of Soup Sieve
bounds it. If long selector strings are a concern, for example because selectors come from untrusted input, limiting
their length is the responsibility of the application, before it passes them to Soup Sieve.

Proof of concept

import soupsieve as sv
from bs4 import BeautifulSoup

soup = BeautifulSoup('<div lang="en">x</div>' * 1000, 'html.parser')
sel = ':lang(' + ','.join(['x-v{}'.format(i) for i in range(7500)]) + ')'  # 57.5 KB, one selector
sv.select(sel, soup)

Measured on one machine, with 1,000 elements:

| Selector | Size | 4.1.1, no `lang` | 4.1.1, `lang="en"` | Fixed, either |
|---|---|---|---|---|
| `:lang()` with 3,750 values | 11.0 KB | 0.09 s | 1.6 s | 0.003 s |
| `:lang()` with 7,500 values | 22.0 KB | 0.17 s | 3.2 s | 0.005 s |
| `:lang()` with 7,500 distinct values | 57.5 KB | 0.18 s | 3.6 s | 0.005 s |

Impact

An application that compiles selectors from untrusted input can be made to spend CPU time proportional to the length
of the selector times the size of the document. This needs an attacker who controls the selector, and a document large
enough for the time to matter. It does not affect applications that only use their own selectors.

Soup Sieve's documentation already advises that taking untrusted selectors in a time-critical system needs a way to
abort long-running operations.

Affected versions

4.1.1 and earlier.

Patched versions

4.1.2

Fix

  • `:lang()` stops checking an element's language against a list as soon as one value matches.
  • The result of matching a language against a `:lang()` list is cached for the duration of a call such as
  • The documentation now states that `max_selectors` limits the number of selectors, not their length or the values in

With the fix, the cost of a `:lang()` list is proportional to the number of values times the number of distinct
languages in the document, which is usually small.

Mitigation

For versions before the fix, and as good practice for any application that accepts untrusted selectors:

  • Limit the length of selector strings before compiling them, for example by rejecting any selector longer than your
  • If `:lang()` is not needed, disable it with the `ignore` option, for example `sv.compile(selector, ignore=[':lang'])`.
  • Run selector matching with a time limit, or in a worker that can be stopped, when the selectors or documents come

Severity

Low, `CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L` (3.7). The cost is linear, and it needs an application that
compiles untrusted selectors and matches them against large documents.

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Vector CVSS 3.1

Desglose de métricas

Opción resaltada = valor del vector · izquierda = peor caso · GitHub
Vector de ataqueAV:N
RedAdyacenteLocalFísica
ComplejidadAC:H
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:L
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
7.1/ 10Alto
Vector 7.1 (fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
soupsieve≤ 4.1.2
4.1.2
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypisoupsieve
Sin parche — — 4.1.2 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/facelessuser/soupsieve/security/advisories/GHSA-crc3-r666-fwc8

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.