Loading advisory.
Loading advisory.
Mistune: Quadratic-time DoS in inline image parsing (precedence_scan) bypasses not-is-image guards
Fixed in Mistune 3.3.4. Upgrade to 3.3.4 or later.
Published 2026-11-17 19:17 UTC · Modified 2026-11-19 23:00 UTC
Severity and EPSS are shown separately. Helm does not combine them into one score. How tiers work
| Package | Ecosystem | Affected | Fixed in | Upgrade command |
|---|---|---|---|---|
| mistune | PyPI | < 3.3.4 versions 0.1.0, 0.2.0, 0.3.0, 0.3.1, 0.4, 0.4.1, 0.5, 0.5.1, 0.6, 0.7, 0.7.1, 0.7.2, 0.7.3, 0.7.4, 0.8, 0.8.1, 0.8.2, 0.8.3, 0.8.4, 2.0.0 and 35 more | 3.3.4 | pip install --upgrade 'mistune>=3.3.4' |
Fixed in Mistune 3.3.4. Upgrade to 3.3.4 or later.
Affected versions: < 3.3.4
First patched version: 3.3.4
Fix: https://github.com/lepture/mistune/compare/v3.3.3...v3.3.4
The reported payload was reproduced against the 3.3.3 release tag and verified to scale approximately linearly against the 3.3.4 release tag.
The following report describes the issue before the fix.
mistune's inline image parsing reaches precedence_scan for ![ openers because the two guards that keep the link path linear are both gated behind not is_image. A small default-renderer document of the form "![" * N + "x" + "]" * N produces O(N²) CPU with no plugins.
For ![ openers, is_image is True, so both linearizing guards are skipped: if not is_image and pos <= state.no_link_before (inline_parser.py:141) and has_nested_link = not is_image and _label_contains_link(...) (:171). Execution reaches precedence_scan (:179) which runs sc.search(state.src, mark_pos, end_pos) over the whole image body — O(n) per outer opener, x O(n) openers -> O(n²). max_image_depth never fires because the failing scans never produce an image token (image_depth stays 0).
A single unauthenticated request pins a worker at 100% CPU. Measured on default mistune.html, no plugins: 6KB->0.28s, 12KB->1.07s, 24KB->4.20s, 48KB->15.8s (2x input -> ~3.8x time).
import mistune
md = mistune.create_markdown() # default, no plugins
md("![" * 16000 + "x" + "]" * 16000)Entry: rendered markdown -> "!["*N + "x" + "]"*N (no plugins). Guard: none on input size. Bypass proof: no global cap.
Check: not is_image guards at inline_parser.py:141 (no_link_before) and :171 (_label_contains_link). Guard: high-water mark + nested-link short-circuit. Bypass proof: is_image is True for ![, so BOTH guards are gated out; max_image_depth (:checked after) measured flat across all values because no image token is produced.
Processing: reaches precedence_scan (:179) -> sc.search(state.src, mark_pos, end_pos) over the full body per opener.
Sink: O(N) openers x O(N) scan -> O(N²) CPU.
Impact: 48KB -> ~16s single-threaded worker stall.
The LINK payload "["*n+"x"+"]"*n is LINEAR on HEAD (0.076s @ 16k, ~2x per 2x) because links get the _label_contains_link short-circuit; the IMAGE payload "!["*n+"x"+"]"*n is O(n²) (0.27->1.05->3.92s, ~3.8x). Same HEAD, only is_image differs — proves the guard asymmetry, not incidental input growth.
max_image_depth set across 0..100 leaves runtime flat (no image token produced by failing scans).
<= 3.3.3 (present on latest release tag v3.3.3 and HEAD).
Generalize the no_link_before high-water mark (and/or the _label_contains_link short-circuit) to cover the image path, so failed ![ scans do not each re-traverse the document.
Reported by zx (Jace) — GitHub: @manus-use
Exploit code or a detection template for this CVE is published by the sources below. This is not a report of use against real systems (that is what CISA KEV records) and it does not change the tier.
EPSS went from 0.005 on 2026-11-24 to 0.006 on 2026-11-26, over 2 recorded scores.
| Date | Score | Previous | Model |
|---|---|---|---|
| 2026-11-24 | 0.005 | first score | v2026.06.15 |
| 2026-11-26 | 0.006 | 0.005 | v2026.06.15 |