Mistune: Quadratic-time DoS in inline image parsing (precedence_scan) bypasses not-is-image guards
Severity and exploitation
KEV coverage does not rule out exploitation.
Assessment vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HAssessment vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:HSeverity
high7.5CVSS measures technical severity, not the likelihood of an attack.
Known exploitation
Not listed in the checked CISA KEV catalog
Absence from CISA KEV does not rule out attacks.
Public exploit
Not established by this record
Missing evidence does not mean no public exploit exists.
Remediation
Package fixes recorded
Fix versions are recorded for 1 of 1 mapped packages. Check each release branch and any separate product guidance.
What this means
Fixed in Mistune 3.3.4. Upgrade to 3.3.4 or later.
Source excerpt · OSVAttack conditions
No attack-condition excerpt has been identified here. Review the full source description and references for authentication, network access, and configuration requirements.
Review supporting sources →Affected versions
Check the exact model, release, and any platform requirements against your installation.
lepture · GitHub_M
mistune
1 range
lepture · GitHub_M
mistune
Compare with this publisher’s ranges. This does not inspect your installation.
affected
< 3.3.4
Other versions: unknown
Packages
Compare each installed version with the publisher’s affected ranges. Where a fix is recorded, choose the appropriate release branch and test compatibility before upgrading.
| Affected range | Recorded fix |
|---|---|
| Earlier releases before 3.3.4Ecosystem versions | 3.3.4 |
Version evidence: OSV · GHSA-ww7q-mxrj-5ffg
View original version evidence (55 explicit versions)
What to do
Compare your installed product and version with the affected versions above. A matching product name alone does not confirm exposure.
Use the recorded fix for your release branch. Review the publisher’s instructions and test compatibility before upgrading.
cve.new guidance unless attributed to a publisher. This page does not inspect your installation.
Public exploit evidence
No public exploit reference is identified in the imported evidence. This is not a claim that no exploit exists.
Original source description
Read the full publisher description
Resolution
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.
Original report
The following report describes the issue before the fix.
Summary
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.
Root Cause
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).
Impact
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).
Proof of Concept
import mistune
md = mistune.create_markdown() # default, no plugins
md("![" * 16000 + "x" + "]" * 16000)
Attack Chain
- Entry: rendered markdown ->
"!["*N + "x" + "]"*N(no plugins). Guard: none on input size. Bypass proof: no global cap. - Check:
not is_imageguards at inline_parser.py:141 (no_link_before) and :171 (_label_contains_link). Guard: high-water mark + nested-link short-circuit. Bypass proof:is_imageis 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.
Bypass Evidence
- The LINK payload
"["*n+"x"+"]"*nis LINEAR on HEAD (0.076s @ 16k, ~2x per 2x) because links get the_label_contains_linkshort-circuit; the IMAGE payload"!["*n+"x"+"]"*nis O(n²) (0.27->1.05->3.92s, ~3.8x). Same HEAD, onlyis_imagediffers — proves the guard asymmetry, not incidental input growth. max_image_depthset across 0..100 leaves runtime flat (no image token produced by failing scans).
Affected Versions
<= 3.3.3 (present on latest release tag v3.3.3 and HEAD).
Suggested Fix
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
References
5 sourcesInside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-97699View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Contributing organizations · 2
Assigning organization
Additional data publisher
Timeline
All times UTCAdvisory published
Publication date supplied by the source.
Source updated
Latest modification date supplied by the source.
Last imported by cve.new
Latest catalog import, not the date we first saw this advisory.
What changed
Follow changes- CVE · CVE-2026-97699
Observed 2026-11-17T23:12:10.972Z · upstream updated 2026-11-17T22:25:23.243Z
Prioritization updated
before
[]
after
[ { "source": "CISA-ADP", "type": "SSVC", "role": "CISA Coordinator", "timestamp": "2026-11-17T22:18:58.611884Z", "decisions": [ { "name": "Exploitation", "value": "none" }, { "name": "Automatable", "value": "yes" }, { "name": "Technical Impact", "value": "partial" } ] } ]
Large field values are marked as truncated previews. Original source snapshots remain retained.
Showing up to 50 most recent observed changes.