llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · pymdown-extensions

GHSA-J5PM-9MX9-PGGQ

Exponential ReDoS in pymdownx.blocks.html/caption selector parsing enables unauthenticated remote DoS

Texto original en inglés · Ver en español

Parche disponible
Descargar PNG JSON
CVSS 3.1
7.5
Alta
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H Fuente: GitHub
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche a -77 d de la divulgación
Exposición14 dDesde la divulgación, 7 nov 2026, 11:08 a. m.
Detección11 dDesde 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, automatizable e impacto técnico parcial. Hay versiones corregidas disponibles.
Saqué la lupa: aquí hay algo que investigar.Ojo de llama: esto puede escalar.
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 11.0.2
Monitoreo
Detectada +1
22 ago 26
7 nov 26
18 nov 26
21 nov 26
22 ago 26
14 sept 26
7 oct 26
30 oct 26
21 nov 26
FechaFaseEventoDetalle
Remediación Parche 11.0.2 pymdown-extensions · -77 d desde divulgación
Divulgación Publicada GHSA-J5PM-9MX9-PGGQ divulgada · CVSS 7.5 (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
`pymdownx.blocks.html` (and `pymdownx.blocks.caption`) are vulnerable to exponential catastrophic backtracking (ReDoS) when parsing a block's CSS-style selector argument. A sub-60-byte block pins the render thread at 100% CPU for tens of seconds, enabling unauthenticated remote denial of service anywhere untrusted Markdown is rendered with the extension enabled.

## Root Cause
A generic block `/// html | <ARG>` passes the fully attacker-controlled selector `<ARG>` to `parse_selectors()` (`pymdownx/blocks/html.py:152` via `HTML.on_validate`; `caption.py:243` via `Caption.on_validate` with `require_tag=False`). `parse_selectors` runs `RE_ATTRS`/`RE_ATTR` built from two catastrophic-backtracking regexes:
- `PAT_ATTR` (html.py:31-33): `\[(?:{ws}*(?P<attr_name>{ident}){attr})+{ws}*\]` — an outer `+` over an attribute whose `=value` is optional and whose `{ident}` is itself a `(...)+`/`(...)*` over overlapping classes. An unterminated `[aaaa…` makes the outer `+` and the inner identifier repeats partition the run exponentially.
- `VALUE` (html.py:18-20): `(?:\\(?:.)|[^\\"\r\n\f]+)*?` — a classic `(A|B+)*?` nested quantifier (greedy `+` inside a lazy `*?` over the same char set). An unterminated quoted value `"aaaa…` explodes.

## Impact
Unauthenticated remote DoS (CWE-1333). Distinct from CVE-2025-68142 (which is the polynomial `RE_FIG_NUM` at `caption.py:35`, a different regex). Any service rendering untrusted Markdown with `pymdownx.blocks.html` or `pymdownx.blocks.caption` enabled (default options) hangs.

Proof of Concept

import markdown
s = '/// html | div[' + 'a'*20 + '\n\ncontent\n///\n'   # 49-byte selector
markdown.markdown(s, extensions=['pymdownx.blocks.html'])    # ~37 s
# Caption path (require_tag=False, needs leading '['):
# s = '/// caption | [' + 'a'*18 + '\n\ncontent\n///\n'

## Attack Chain
1. Entry: `markdown.markdown('/// html | div[' + 'a'*20 + '\n\ncontent\n///\n', extensions=['pymdownx.blocks.html'])`. Guard: `RE_START` (blocks/__init__.py:28-30) requires only a valid block name (`html`); the `div` tag and `[…]` selector are never length-bounded or validated. Bypass proof: end-to-end hang, table below.
2. Regex: `parse_selectors` calls `RE_ATTRS.match`/`RE_ATTR.search` (html.py:64/81/101) on the unterminated selector and backtracks over all partitions. Guard: none — no atomic groups, no possessive quantifiers, no length bound on `self.argument`. Sink = html.py:18-33. Bypass proof: raw `RE_ATTRS.match`/`VALUE` isolation shows the same exponential curve independent of markdown overhead.
3. Impact: render thread pegged for seconds→minutes on a <60-byte input → DoS. Reachable via both `blocks.html` and `blocks.caption`.

## Bypass Evidence
Measured via `markdown.markdown(...)`, DEFAULT config:

Variant A '/// html | div[' + a*n:    n=18 len=47   5.39 s;  n=20 len=49  37.10 s
Variant B '/// html | div[a="' + a*n: n=26 len=58   5.41 s;  n=28 len=60  21.32 s
Caption   '/// caption | [' + a*n:    n=18 len=47   5.38 s

Control (`extensions=[]`): 0.0004 s — proves backtracking originates in the finding's regexes. Constant per-increment multiplier (~6.8×/+2 chars) confirms exponential, not polynomial.

## Affected Versions
`<= 11.0.1` (latest release). Fix commit c684985 (CVE-2026-67422) never audited the `blocks` package; these regexes are untouched. No fix on HEAD.

Mitigation

If you feel you are affected by this, or you cannot tolerate the risk, the HTML Blocks extension is an option extension that can be disabled.

## Suggested Fix
Collapse `VALUE`'s overlapping alternation to a single non-overlapping class (`"(?:\\.|[^\\"\r\n\f])*?"`, dropping the inner `+`) and de-ambiguate/bound `PAT_ATTR`'s outer/inner repeats, mirroring the c684985 approach of eliminating partition ambiguity.

---
Reported by zx (Jace) — GitHub: @manus-use

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:L
BajaAlta
PrivilegiosPR:N
NingunoBajosAltos
InteracciónUI:N
NingunaRequerida
AlcanceS:U
CambiadoSin cambio
ConfidencialidadC:N
AltoBajoNinguno
IntegridadI:N
AltoBajoNinguno
DisponibilidadA:H
AltoBajoNinguno
Score de explotaciónQué tan fácil y probable es que la exploten
10.0/ 10Muy alto
Vector 10.0 (muy fácil) · sin evidencia de explotación.
Versiones

Rangos afectados

Afectada Corregida Última
pymdown-extensions≤ 11.0.1
11.0.1
13.1.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypipymdown-extensions
Corregida 11.0.2 -77 d 13.1.0 no afectada
Versiones corregidas11.0.2
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/pymdown-extensions/security/advisories/GHSA-j5pm-9mx9-pggq

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