llamaCVEVulnerability Intelligence
/
Advisory · GitHub · PyPI · mistune

GHSA-F32H-38GF-RG5R

Quadratic DoS in parse_link_text via unmatched bracket runs

Parche disponible
Descargar PNG JSON
CVSS
—
medium
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
Parche1 versiónPrimer parche el mismo día de la divulgación
Exposición151 dDesde la divulgación, 21 jun 2026, 8:25 a. m.
Detección150 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Parche 3.3.0
Monitoreo
Detectada +1
21 jun 26
19 nov 26
21 jun 26
29 jul 26
5 sept 26
13 oct 26
19 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-F32H-38GF-RG5R divulgada
Remediación Parche 3.3.0 mistune · 0 d desde divulgación
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
Feeding mistune.html() a string of unbalanced square brackets makes the call run in quadratic time. About 25 KB of brackets stalls a worker past 15 seconds on a Mac M2. 50 KB drags it out to roughly two minutes. Any server-side caller of mistune.html() on markdown an attacker can influence can be wedged.

### Details
The payload is [ times N, then a single x, then ] times N. Every [ opens a parse_link attempt. parse_link calls parse_link_text in helpers.py, which forward-scans the rest of the source balancing brackets. The text ends up not being a link (no (url) after the closing bracket), the outer inline loop bumps the cursor by one character, and the next [ does the whole scan again. N full scans of an N-character input. Profile on N=1600 shows parse_link_text called 1599 times with about 2.56 million re.Pattern.search calls underneath, which is N² right on the money.

Tested on 3.2.0, then 3.2.1, then main HEAD. Identical on all three. The 3.2.1 release notes don't touch parse_link_text.

This isn't GHSA-hjph-f4mc-wx4c / CVE-2026-33441 from the May batch. That one's parse_link_title reached via malformed [label]: reference definitions with escaped brackets.

Suggested fix: cap how far parse_link_text scans forward. The existing LINK_LABEL = r"(?:[^\\\[\]]|\\.){0,500}" already does this kind of thing. Optimising failed start positions for a given source would also work but the cap is the one-line option and matches code already in the file.

PoC
pip install mistune==3.2.1

import mistune, time
for n in (400, 800, 1600, 3200, 6400, 12800):
      md = '[' * n + 'x' + ']' * n
      t = time.perf_counter()
      mistune.html(md)
      print(n, len(md), f'{(time.perf_counter()-t)*1000:.0f} ms')

Output, Python 3.14, mistune 3.2.1:

400 801 35 ms
800 1601 130 ms
1600 3201 501 ms
3200 6401 2003 ms
6400 12801 8066 ms
12800 25601 killed at >15000 ms

Doubling N quadruples the time.

### Impact
Denial of service. CWE-407 inefficient algorithmic complexity.

Anyone calling mistune.html() on input an attacker can influence. Web forms, comment fields, federated content, scheduled jobs pulling markdown from an external feed. Our own use is a Celery task rendering markdown from a first-party source so direct exposure for us is low, but the bug class hits every downstream putting user-facing markdown through mistune.

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

Versiones

Rangos afectados

Afectada Corregida Última
mistune< 3.3.0
3.3.0
3.4.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
pypimistune
Corregida 3.3.0 0 d 3.4.0 no afectada
Versiones corregidas3.3.0
Explotación

Arsenal público

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

Referencias
Advisoryhttps://github.com/lepture/mistune/security/advisories/GHSA-f32h-38gf-rg5r

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