VAITP Dataset

← Back to the dataset

CVE-2026-97699

Quadratic CPU DoS via nested image parsing 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, inline image parsing sends nested ![ openers through precedence_scan because the no_link_before and _label_contains_link linearization guards are gated by not is_image. In src/mistune/inline_parser.py, each outer image opener can therefore search the remaining image body, while max_image_depth does not apply because the failed scans do not produce image tokens. 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
A04 Insecure Design
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: default parser allows unlimited nested image scans
def render(text: str) -> str:
    """Render markdown to HTML using the vulnerable default parser."""
    markdown = mistune.create_markdown()
    return markdown(text)

Patched code sample

import mistune

# FIX: limit image parsing depth to prevent quadratic scans
def render(text: str) -> str:
    """Render markdown to HTML with a hardened parser."""
    # The `max_image_depth` argument caps how deep image parsing may recurse.
    markdown = mistune.create_markdown(max_image_depth=1)
    return markdown(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:cve202697699,
  title        = {{Quadratic CPU DoS via nested image parsing 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-97699},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-97699/}}
}

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.