GHSA-249C-7RGC-F52H
Regular-expression Denial of Service (ReDoS) in svglib <path> elliptical-arc parser (svg2rlg / svg2pdf)
Texto original en inglés · Ver en español
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-249C-7RGC-F52H divulgada · CVSS 7.5 (GitHub) | |
| Remediación | Parche 2.3.2 | svglib · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
The SVG `<path>` elliptical-arc parser in `svglib.utils.split_arc_values()` builds a regex with multiple empty-matchable float groups and two mandatory flag groups, then runs it under `re.finditer()`. An arc argument that is a long run of digits (containing no `0`/`1` where a flag is expected) triggers catastrophic backtracking whose cost grows exponentially (~2x per ~4 extra digits). Reachable from any untrusted SVG via `svg2rlg` / `svg2pdf`.
### Details
`svglib/utils.py` builds:
float_re = r"(-?\d*\.?\d*(?:[eE][+-]?\d+)?)" # matches the empty string
a_seq_re = r"[\s,]*".join([float_re]*3 + [flag_re]*2 + [float_re]*2) + r"[\s,]*"
re.finditer(a_seq_re, value) # value = a <path> arc argumentBecause the float groups can match empty, a digit run with no valid flag char forces the engine to try ~2^(n/4) ways to split the run across the leading float groups, each failing at the mandatory flag group. Path: `svg2rlg()` -> `normalise_svg_path()` -> `split_arc_values()`.
Affected: svglib `<= 2.3.0`. CWE-1333/400/407 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H (7.5).
Proof of concept
from svglib.utils import split_arc_values # reached via svg2rlg -> normalise_svg_path
split_arc_values("A", "9" * 60) # ~60-digit arc argument: does not returnVerified on PyPI svglib 2.3.0 (cost ~2x per 4 extra digits): 42 digits -> 6.7s, 50 -> ~30s; a ~60-80 digit arc argument (a ~120-150 byte SVG) runs for minutes to hours. The regex runs in C and cannot be interrupted by `signal.alarm`; a subprocess timeout is required.
### Impact
A single small SVG blocks the worker for minutes-to-indefinitely (CPU) -> one-request DoS for any `svg2rlg`/`svg2pdf` caller. Same class as CairoSVG ReDoS (CVE-2021-21236).
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypisvglib |
Corregida | 2.3.2 | 0 d | 2.4.0 no afectada |
2.3.2Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/deeplook/svglib/security/advisories/GHSA-249c-7rgc-f52hLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
