GHSA-X54X-CHHH-HG94
Critic extension: quadratic and cubic processing time on unclosed CriticMarkup
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:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-X54X-CHHH-HG94 divulgada · CVSS 5.3 (GitHub) | |
| Remediación | Parche 13.0.0 | pymdown-extensions · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The `pymdownx.critic` extension locates CriticMarkup with a single regular expression. When the input contains many opening markers with no matching closer, the cost of that search grows quadratically with input size. For substitutions it grows cubically. A small crafted document can tie up a renderer for seconds to minutes.
Details
The expression matches an opener (`{++`, `{--`, `{==`, `{>>`, `{~~`) followed by a lazy `.*?` and a required closer such as `++}`. If no closer exists, each opener scans to the end of the text and fails, and the search then retries from the next opener. With *n* unclosed openers the total work is O(n²).
The substitution form (`{~~old~>new~~}`) has two nested lazy scans, and the engine retries every later `~>` as the middle marker. That makes it O(n³).
Timings on a single machine (Python 3.14, Python Markdown 3.11):
| Input | Size | Time |
|---|---|---|
| `"{++" * 12800` | 38 KB | about 3.2 s |
| `"{++" * 25600` | 77 KB | about 13 s (extrapolated from the 4x growth per doubling) |
| `"{~~a~>b" * 2000` | 14 KB | about 83 s |
Python Markdown without the extension handles the same inputs in milliseconds.
Impact
Applications that render untrusted Markdown with `pymdownx.critic` enabled can be driven to high CPU use by one small request. Sites that use the extension only on trusted content are not meaningfully affected.
Patches
Fixed in 12.4. The regular expression is replaced by a linear-time scanner. If no closer of a given type exists after one opener, none can exist after any later opener of that type, so the scanner skips the remaining openers of that type. Every character is therefore examined a bounded number of times. In testing, the old and new implementations produced identical results on hundreds of thousands of randomized inputs, and unclosed payloads of over a million openers now process in a fraction of a second.
Workarounds
Disable `pymdownx.critic` for untrusted input, or limit input size and set render timeouts in the application.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypipymdown-extensions |
Corregida | 13.0.0 | 0 d | 13.1.0 no afectada |
13.0.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/facelessuser/pymdown-extensions/security/advisories/GHSA-x54x-chhh-hg94Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
