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

GHSA-W3P6-XVP9-C78V

Quadratic ReDoS in pymdownx.tilde and pymdownx.caret default smart processor

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.
Ojo con los rangos de versión, son traicioneros.Ponle fecha: las tareas sin fecha son leyendas.
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-W3P6-XVP9-C78V 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

In pymdown-extensions 11.0.1, `PatternSequenceProcessor.handleMatch()` tries every `TildeSmartProcessor.PATTERNS` regex at each `~`. For `~a~~a~~a...`, `SMART_DEL_SUB3` scans most of the remaining suffix before failing, producing quadratic work. An unauthenticated attacker can reach this path through a downstream service that explicitly enables `pymdownx.tilde`, accepts attacker-controlled Markdown, and uses the default options. The library has no input-length or render-time limit. `pymdownx.extra` does not enable `pymdownx.tilde`.

Similar behavior can be observed in `pymdownx.caret` as well.

It should be noted that the inline processor path of Python Markdown is not linear, so not all quadratic work measured can be attributed solely to the Tilde's implementation. Reasonable fixes within Pymdown Extensions will not prevent all risks of quadratic work as Python Markdown does not process work linearly, and this is an extension for Python Markdown.

Vulnerable pattern and registration:
https://github.com/facelessuser/pymdown-extensions/blob/c68498598d7b13011bb4571350b6e3612a4ce44b/pymdownx/tilde.py#L78-L110

Default configuration:
https://github.com/facelessuser/pymdown-extensions/blob/c68498598d7b13011bb4571350b6e3612a4ce44b/pymdownx/tilde.py#L144-L179

Unbounded pattern dispatch:
https://github.com/facelessuser/pymdown-extensions/blob/c68498598d7b13011bb4571350b6e3612a4ce44b/pymdownx/util.py#L317-L335

PoC

In order to demonstrate what Pymdown Extensions is specifically capable of improving, outside of Python Markdown, a simple baseline extension is compared against. Improvements must be compared against a baseline, as Python Markdown itself may be responsible for a portion of the quadratic work and would be outside the scope of any fix here.

Preconditions:

  • pymdown-extensions 10.13–11.0.1
  • `pymdownx.tilde` enabled with default options (but are specified specifically in case the defaults change)
  • Attacker-controlled Markdown without an input-size or render-time limit

( P.S. this unexecuted reproducer consumes CPU; do not increase its sizes on shared or production systems)

import time
import markdown
import xml.etree.ElementTree as etree
from markdown import Extension
from markdown.inlinepatterns import InlineProcessor

class TestProcessor(InlineProcessor):
    def handleMatch(self, m, data):
        el = etree.Element('span')
        el.text = m.group(1)
        return el, m.start(0), m.end(0)

class TestExtension(Extension):
    def extendMarkdown(self, md):
        test = TestProcessor(r'%([^%]+)%')
        md.inlinePatterns.register(test, "span", 40)

ranges = (500, 1_000, 2_000)

print('=== Baseline ===')
for blocks in ranges:
    payload = "%a" + "%%a" * blocks
    started = time.perf_counter()
    markdown.markdown(payload, extensions=[TestExtension()])
    print(blocks, time.perf_counter() - started)


print('=== Tilde ===')
for blocks in (500, 1_000, 2_000):
    payload = "~a" + "~~a" * blocks
    started = time.perf_counter()
    markdown.markdown(payload, extensions=["pymdownx.tilde"], extension_configs={"pymdownx.tilde": {"smart_delete": True}})
    print(blocks, time.perf_counter() - started)

Runtime should grow superlinearly (or closer to it based on Python Markdown's limitations) as `blocks` doubles. `NOT_TILDE` only handles tilde runs surrounded by whitespace, so it does not match this input. After `SMART_DEL_SUB3` fails, `handleMatch()` returns `(None, None, None)` and Python-Markdown continues to later tilde positions, repeating the suffix scan. Release 11.0.1 changes only `SUB2`; it leaves `SMART_DEL_SUB3` unchanged. Rewrite delimiter matching so each suffix is scanned once and add a regression test asserting linear scaling.

Impact

A downstream network service synchronously rendering unauthenticated Markdown can have its workers exhausted by repeated requests. GHSA-gm37-52c6-37mw / CVE-2026-67422 covers exponential ReDoS in `SUB2` and identifies 11.0.1 as fixed, but does not describe this residual `SMART_DEL_SUB3` path.

Mitigation
  • `pymdownx.tilde` and `pymdownx.caret` can be disabled if on a system that cannot tolerate such issues.
  • It should be noted that Python Markdown's processing is not linear in general, so care should be used when considering where it is employed. While great for documentation, running on a critical server and accepting untrusted user input without employing timeouts and restricting large user input is not advised.

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≥ 10.13 ≤ 11.0.1
10.13
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-w3p6-xvp9-c78v

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