CVE-2026-76098
DoS via deep token nesting in Mistune 3.3.0‑3.3.2 causing RecursionError.
- CVSS 7.5
- CWE-674
- Resource Management
- Remote
Mistune is a Python Markdown parser with renderers and plugins. Versions 3.3.0 through 3.3.2 are vulnerable to DoS through deeply nested tokens. HTML rendering creates deeply nested emphasis tokens from consecutive asterisk characters, and recursive rendering in HTMLRenderer.render_token() can exceed Python's recursion limit and raise RecursionError, allowing crafted Markdown to crash a parsing process. This issue is fixed in version 3.3.3
- CWE
- CWE-674
- CVSS base score
- 7.5
- Published
- 2026-08-24
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Upgrade Mistune to version 3.3.3 or later.
Vulnerable code sample
import mistune
def render_markdown(text: str) -> str:
"""Render markdown to HTML using the default renderer."""
# VULNERABLE: deep nesting can cause recursion overflow
renderer = mistune.HTMLRenderer()
markdown = mistune.create_markdown(renderer=renderer)
return markdown(text)Patched code sample
import mistune
def render_markdown(text: str) -> str:
"""Render markdown to HTML with a nesting limit."""
# FIX: limit token nesting depth to avoid recursion overflow
renderer = mistune.HTMLRenderer(max_nesting=10)
markdown = mistune.create_markdown(renderer=renderer)
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.
- fix: add max_emphasis_depth (lepture/mistune)
src/mistune/inline_parser.py,src/mistune/inline_parser.py · InlineParser.parse,src/mistune/inline_parser.py · InlineParser.__init__,src/mistune/inline_parser.py · _finalize_emphasis_tokens,src/mistune/inline_parser.py · _process_emphasis_delimiters
Cite this entry
@misc{vaitp:cve202676098,
title = {{DoS via deep token nesting in Mistune 3.3.0‑3.3.2 causing RecursionError.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-76098},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-76098/}}
}
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 ::
