VAITP Dataset

← Back to the dataset

CVE-2026-97698

Quadratic CPU DoS via empty link labels causing unbounded scans in Mistune < 3.3.4.

  • CVSS 7.5
  • CWE-400
  • Resource Management
  • Remote

Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.4, parse_link_href performs an unbounded parenthesis-balancing scan to the end of the document for each unmatched opening parenthesis reached through an empty [] link label. In src/mistune/helpers.py and src/mistune/inline_parser.py, the empty label bypasses no_close_bracket_before, and no_link_before advances only past the short label, so successive [] ( candidates repeatedly scan the remaining document. Rendering untrusted Markdown with the default HTML renderer and no plugins can perform quadratic CPU work and keep a worker at 100 percent utilization. This issue is fixed in version 3.3.4.

CVSS base score
7.5
Published
2026-11-17
OWASP
A06 Vulnerable and Outdated Components
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
Mistune
Fixed by upgrading
Yes

Solution

Upgrade Mistune to version 3.3.4 or later.

Vulnerable code sample

import mistune

# VULNERABLE: empty link label triggers quadratic parsing
def render_markdown(text: str) -> str:
    # Default parser scans the whole document for each [](
    markdown = mistune.create_markdown()
    return markdown(text)

Patched code sample

import mistune
import re

# FIX: sanitize empty link labels to avoid the quadratic scan
def render_markdown(text: str) -> str:
    # Replace empty link labels with a placeholder to bypass the buggy path
    safe_text = re.sub(r'\[\]\(', '[placeholder](', text)
    markdown = mistune.create_markdown()
    return markdown(safe_text)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • perf: optimize inline edge-case parsing (lepture/mistune)
    src/mistune/core.py · InlineState.copy, src/mistune/core.py · InlineState.__init__, src/mistune/helpers.py, src/mistune/helpers.py · parse_link, src/mistune/helpers.py · parse_link_href, src/mistune/inline_parser.py, src/mistune/inline_parser.py · InlineParser.parse_link, src/mistune/inline_parser.py · _has_emphasis_enabled, src/mistune/inline_parser.py · _has_strong_enabled, src/mistune/inline_parser.py · _process_emphasis_delimiters, src/mistune/inline_parser.py · _split_text_token

Cite this entry

@misc{vaitp:cve202697698,
  title        = {{Quadratic CPU DoS via empty link labels causing unbounded scans in Mistune < 3.3.4.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-97698},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-97698/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.