CVE-2026-59925 Overview
CVE-2026-59925 is a denial of service vulnerability in Mistune, a Python Markdown parser with renderers and plugins. Versions prior to 3.3.0 exhibit quadratic parsing behavior when processing long sequences of well-formed double-asterisk or triple-asterisk emphasis pairs around a character. The parser in src/mistune/inline_parser.py scans forward for matching close markers from every potential opening run, creating an algorithmic complexity attack surface [CWE-407]. Remote attackers can submit crafted Markdown input to exhaust CPU resources and cause denial of service in default Mistune parsing configurations. The issue is fixed in Mistune version 3.3.0.
Critical Impact
Unauthenticated remote attackers can trigger quadratic parsing behavior to exhaust CPU and cause denial of service in any application relying on Mistune to parse untrusted Markdown input.
Affected Products
- Mistune Python Markdown parser versions prior to 3.3.0
- Applications embedding Mistune with default parsing configuration
- Web services accepting untrusted Markdown input processed through Mistune
Discovery Timeline
- 2026-07-08 - CVE-2026-59925 published to NVD
- 2026-07-08 - Last updated in NVD database
Technical Details for CVE-2026-59925
Vulnerability Analysis
The vulnerability resides in Mistune's inline parser logic located in src/mistune/inline_parser.py. When the parser encounters emphasis markers such as ** (bold) or *** (bold italic), it attempts to locate matching close markers by scanning forward from each candidate opening run. For each potential opening position, the parser performs a forward scan across the remaining input to identify valid pairs.
When input contains long sequences of well-formed emphasis pairs surrounding a character, this scanning behavior produces quadratic time complexity relative to input length. Processing time grows as O(n²), enabling an attacker to submit modestly sized inputs that consume disproportionate CPU resources. The vulnerability class [CWE-407] covers algorithmic complexity attacks of this kind.
Root Cause
The root cause is inefficient matching logic for CommonMark emphasis delimiters. The parser does not memoize or short-circuit repeated forward scans across overlapping delimiter runs. Every candidate opening delimiter triggers an independent traversal of subsequent tokens, multiplying work across the input.
Attack Vector
Exploitation requires only the ability to submit Markdown content to a target application. No authentication or user interaction is needed. Applications that render user-supplied Markdown, such as forums, wikis, comment systems, chat platforms, or documentation portals, are exposed. A single crafted request containing repeated **x** or ***x*** patterns can tie up a worker process for seconds or longer.
The patch in Mistune 3.3.0 refactors the parser and aligns it with CommonMark 0.31.2 rules, eliminating the quadratic scan pattern.
)
parsers[f"mistune ({mistune.__version__})"] = mistune.html
- parsers["mistune (slow)"] = mistune.create_markdown(escape=False)
- parsers["mistune (fast)"] = mistune.create_markdown(escape=False, plugins=["speedup"])
+ parsers["mistune (core)"] = mistune.create_markdown(escape=False)
parsers["mistune (full)"] = mistune.create_markdown(
escape=False,
plugins=[
// Source: https://github.com/lepture/mistune/commit/5de41fb8e527004dbc363e047a3c380c9288c74f
The patch commit consolidates parser modes and rewrites emphasis handling. See the GitHub Security Advisory GHSA-4j32-57v6-6g45 for full technical detail.
Detection Methods for CVE-2026-59925
Indicators of Compromise
- Sustained high CPU utilization on Python processes hosting Mistune-based rendering services
- HTTP requests containing unusually long runs of ** or *** emphasis markers in Markdown fields
- Increased request latency or worker timeouts in applications processing user-supplied Markdown
- Repeated identical or similar Markdown payloads submitted from the same source in short intervals
Detection Strategies
- Inventory Python dependencies across repositories and running services to identify Mistune versions prior to 3.3.0
- Deploy application-layer inspection to flag Markdown submissions exceeding size or delimiter-density thresholds
- Correlate spikes in CPU usage on Markdown-rendering workers with inbound request patterns to identify complexity attacks
Monitoring Recommendations
- Track per-request processing time for Markdown endpoints and alert on outliers exceeding baseline
- Monitor Python worker restarts, timeouts, and queue depth for services rendering user content
- Log and rate-limit clients submitting Markdown payloads that exceed defined character or delimiter counts
How to Mitigate CVE-2026-59925
Immediate Actions Required
- Upgrade Mistune to version 3.3.0 or later in all affected applications and container images
- Audit application dependencies (pip list, requirements.txt, poetry.lock) for pinned Mistune versions below 3.3.0
- Apply request-size limits and timeouts on endpoints that render user-supplied Markdown
- Rebuild and redeploy container images that bundle vulnerable Mistune versions
Patch Information
The fix is available in Mistune 3.3.0. See the GitHub Release v3.3.0 and the GitHub Commit Update for details. The release refactors the inline parser and aligns behavior with CommonMark 0.31.2, removing the quadratic emphasis scan.
Workarounds
- Enforce strict input size limits on Markdown fields exposed to untrusted users
- Execute Markdown rendering in isolated worker processes with strict CPU time limits
- Reject or sanitize inputs containing dense sequences of ** or *** delimiters before parsing
- Place a web application firewall rule to inspect and rate-limit suspicious Markdown payloads
# Upgrade Mistune to the patched release
pip install --upgrade "mistune>=3.3.0"
# Verify installed version
python -c "import mistune; print(mistune.__version__)"
# Pin the fixed version in requirements.txt
echo "mistune>=3.3.0" >> requirements.txt
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

