CVE-2026-97698 is a high-severity (CVSS 7.5) Uncontrolled Resource Consumption vulnerability in mistune. A fix is available for mistune — see the affected versions and patch details below.
Mistune: Quadratic-time DoS in parse_link_href via unbounded parenthesis scan on empty-label links
Exploitation Status
Proof-of-concept exploit code exists
- CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.
- CISA assesses this as automatable — exploitation doesn’t require manual, per-target effort, which raises the odds of mass scanning and opportunistic attacks.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-97698.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
Where this sits among everything scored
Real-World Exposure
mistuneReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
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
parse_link_href in mistune performs an unbounded parenthesis-balancing scan that runs to end-of-document on each unmatched (. Because the empty label [] bypasses the no_close_bracket_before high-water-mark guard, a single small document of the form "[](" * N causes O(N) openers to each drive an O(N) scan, producing O(N²) CPU on the default mistune.html() renderer with no plugins.
Root Cause
parse_link matches the empty label [] (parse_link_label("[](",1) returns ('', 2)), so it reaches the ( branch and calls parse_link_href. That function's scan loop (helpers.py:143-159) advances past characters and increments level on each (, never finding an unescaped ) at level==0, so it runs to EOF and returns None. The cursor then advances only ~2 chars to the next [](. The no_close_bracket_before high-water mark that keeps the balanced-bracket link path linear is never entered because the empty label matches before that branch; _mark_no_link_before only advances past the 2-char label, not the href region.
Impact
A single unauthenticated request rendering untrusted markdown pins a worker at 100% CPU for tens of seconds. Measured on default mistune.html, no plugins: 6KB->0.80s, 12KB->3.15s, 24KB->12.5s, 48KB->49.8s (2x input -> ~3.9x time, clean O(n²)). This is the most severe of the mistune quadratic-DoS findings.
Proof of Concept
import mistune
md = mistune.create_markdown() # default HTML renderer, no plugins
md("[](" * 16000) # ~48KB input stalls a worker ~50s
Attack Chain
- Entry: rendered markdown body ->
"[](" * N(3 bytes/unit, no plugins). Guard: none on input size (grep of markdown.py/core.py = no size/time cap). Bypass proof: no global guard exists. - Check:
parse_linkguards at inline_parser.py:141 (no_link_before), :150 (no_close_bracket_before). Guard: high-water marks that linearize balanced-bracket links. Bypass proof: empty label matches (label != None) so the :150 branch is skipped entirely;no_link_beforeonly crawls +2/opener becauseparse_link_labelreturns('',2). - Processing:
parse_link_href(helpers.py:143) scans to EOF per((unbalanced parens), returnsNone. - Sink: O(N) openers x O(N) scan each -> O(N²) CPU.
- Impact: single ~48KB request stalls a worker ~50s (single-threaded); ~200KB approx minutes.
Bypass Evidence
parse_link_label("[](",1)returns('', 2)— the empty label matches, so the balanced-bracket branch owningno_close_bracket_beforeis never entered.git log -S "if c == \"(\":" -- helpers.pyreturns only refactor5de41fb;parse_link_hrefhas NEVER received a DoS fix (all helpers.py DoS fixes targetedparse_link_text).- Empirical: the
[*n unbalanced-bracket payload is LINEAR on HEAD (0.03->0.12s) while[](*n is O(n²) (3.99x per 2x) — proving the fix does not cover this branch.
Affected Versions
<= 3.3.3 (present on latest release tag v3.3.3 and HEAD 719107f; no fix on HEAD).
Suggested Fix
Add a high-water mark for parse_link_href failed scans (mirroring no_link_before/no_close_bracket_before), or bound the parenthesis scan to a maximum length, so repeated failed href scans cannot each traverse the remaining document.
Reported by zx (Jace) — GitHub: @manus-use
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | mistune | all versions | 3.3.4pip install --upgrade 'mistune==3.3.4' |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for mistune, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update mistune to 3.3.4 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-97698 is resolved across your whole dependency graph.
Workarounds
Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.
Frequently Asked Questions
Is CVE-2026-97698 in your dependencies?
Find it across PyPI, including transitive dependencies.