CVE-2026-59925: Mistune Markdown Parser Denial of Service via Quadratic Parsing Complexity
Mistune, a widely-used Python Markdown parser, contains a denial-of-service vulnerability in how it handles emphasis formatting. When processing certain malformed or adversarially crafted Markdown with long sequences of double or triple asterisks (used for bold and italic emphasis), the parser performs redundant scanning that grows quadratically with input length. An attacker can exploit this by sending specially crafted Markdown to any system parsing it with vulnerable Mistune versions, causing the parser to consume excessive CPU and potentially crash or hang the application. Version 3.3.0 eliminates the performance cliff.
Source data · NVD / CISA · public domain
- CVSS
- 3.1 · 7.5 HIGH · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- Weaknesses (CWE)
- CWE-1333, CWE-407
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-08 / 2026-07-09
NVD description (verbatim)
Mistune is a Python Markdown parser with renderers and plugins. Prior to 3.3.0, long sequences of well-formed double-asterisk or triple-asterisk emphasis pairs around a character cause quadratic work in src/mistune/inline_parser.py because the parser scans forward for matching close markers from every potential opening run, allowing denial of service in default Mistune parsing. This issue is fixed in version 3.3.0.
3 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability resides in src/mistune/inline_parser.py, where the inline parser scans forward from every potential opening emphasis marker to find matching closing markers. On input containing long runs of well-formed emphasis pairs (e.g., **a****b****c**...), the parser exhibits O(n²) behavior because it re-scans overlapping candidate ranges. The quadratic complexity allows an attacker to craft payloads that cause parsing time to balloon from milliseconds to seconds or minutes. The issue is rooted in CWE-1333 (Inefficient Regular Expression Complexity) and CWE-407 (Algorithmic Complexity). No code execution or data breach risk exists; the attack surface is purely availability.
Business impact
Applications relying on Mistune to parse user-supplied or untrusted Markdown—such as documentation platforms, comment systems, wiki software, or static site generators—face resource exhaustion attacks. A single malicious Markdown file or POST request can spike CPU usage, degrading service for legitimate users or triggering auto-scaling costs in cloud environments. Widespread adoption of Mistune in Python projects means many organizations may be indirectly affected through dependencies.
Affected systems
Mistune versions prior to 3.3.0 are vulnerable. The vulnerability affects any application or service using Mistune for Markdown parsing, particularly those exposed to untrusted input (e.g., user comments, uploaded documents, API endpoints). This includes static site generators, documentation tools, and any Python project listing Mistune as a direct or transitive dependency.
Exploitability
Exploitability is high. The attack requires only network access (AV:N) and no authentication or user interaction (PR:N, UI:N). An attacker can trigger the vulnerability by sending a single HTTP request or API call containing the crafted Markdown payload. No special privileges, complex setup, or interaction with other vulnerabilities is needed. Public proof-of-concept construction is straightforward—a test can be performed locally to determine if a Mistune version is vulnerable.
Remediation
Upgrade Mistune to version 3.3.0 or later. This version includes algorithmic improvements to the inline parser that eliminate the quadratic behavior. For projects unable to upgrade immediately, input size limits or rate limiting on Markdown parsing requests can provide temporary mitigation, though they are not a substitute for patching.
Patch guidance
Apply version 3.3.0 or any subsequent release. Verify the patch by checking the Mistune version in your environment (e.g., `pip show mistune`) and confirming it reports 3.3.0 or higher. If Mistune is installed as a transitive dependency, update the direct dependency tree—most dependency managers (pip, poetry, pipenv) support `pip install --upgrade mistune` or equivalent. Test in a staging environment to ensure compatibility with your Markdown workflows before rolling out to production.
Detection guidance
Monitor for unusual CPU spikes or parser timeouts when processing Markdown input. In logs, look for parsing operations that take significantly longer than baseline (>5 seconds for small payloads). If feasible, implement input validation rules that reject Markdown with excessive consecutive emphasis markers (e.g., more than 10 consecutive asterisks). Vulnerability scanners can detect Mistune <3.3.0 in dependencies via Software Composition Analysis (SCA) tools. Track Mistune version in your Bill of Materials and flag instances below 3.3.0.
Why prioritize this
CVSS 7.5 (HIGH) reflects the ease of exploitation and moderate impact. While no confidentiality or integrity risk exists, the vulnerability is network-accessible, requires no authentication, and can reliably deny service to end-users or degrade availability for all Markdown parsing operations. Organizations parsing untrusted Markdown at scale should prioritize patching. Given the simplicity of the attack and the potential for widespread deployment, this warrants urgent review and patching cycles.
Risk score, explained
The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H) scores HIGH (7.5) because: Attack Vector is Network (AV:N)—any remote attacker can trigger the flaw. Attack Complexity is Low (AC:L)—no special conditions or race conditions; a simple payload suffices. Privileges Required and User Interaction are None (PR:N, UI:N)—authentication and user clicks are unnecessary. Scope is Unchanged (S:U)—the impact is confined to the Mistune parser and its host process. Availability is High (A:H)—the parser can hang or consume all CPU, effectively denying service. Confidentiality and Integrity remain None (C:N, I:N).
Frequently asked questions
How do I know if my application uses Mistune?
Check your project's dependency file (requirements.txt, setup.py, pyproject.toml, etc.) for 'mistune' or use `pip show mistune` in your environment. Many Python projects and frameworks use it indirectly; use tools like `pip tree` or online SCA platforms (Snyk, Dependabot) to reveal transitive dependencies.
Is this exploitable without sending malicious input?
No. The vulnerability only triggers when the parser processes specially crafted Markdown with long sequences of emphasis markers. Normal, well-formed Markdown or Markdown without excessive consecutive asterisks does not trigger the quadratic behavior. You must actively parse adversarial input to expose the flaw.
Does the patch change the Markdown output or API?
No. Version 3.3.0 preserves backward compatibility. The patch optimizes the parsing algorithm internally without changing the rendered output or public API. Existing code using Mistune should upgrade without modification.
Can I mitigate this without upgrading?
Temporarily, yes—by enforcing strict input length limits (e.g., rejecting Markdown payloads >10 MB) or rate limiting parsing requests. However, these are fragile workarounds. Patching to 3.3.0 is the definitive fix and is strongly recommended.
This analysis is provided for informational purposes and reflects publicly available information as of the publication date. Readers should verify all version numbers, patches, and vendor advisories against official Mistune documentation and release notes. SEC.co does not provide legal, compliance, or deployment advice. Organizations should conduct their own risk assessment and testing in non-production environments before applying patches. No exploit code or weaponized proof-of-concept is provided in this analysis. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-59922HIGHMistune Markdown Parser DoS Vulnerability
- CVE-2026-59928HIGHMistune Markdown Parser Denial of Service via Reference-Link Complexity
- CVE-2026-49293HIGHjs-toml TOML Parser CPU Exhaustion DoS (v1.1.0 and earlier)
- CVE-2026-49851HIGHMistune Markdown Parser CPU Exhaustion DoS Vulnerability
- CVE-2026-13311HIGHshell-quote Algorithmic Denial of Service Vulnerability
- CVE-2026-14895HIGHString::Util ReDoS Vulnerability in Perl trim and rtrim Functions
- CVE-2026-41850HIGHSpring Framework SpEL Denial of Service Vulnerability (CVSS 7.5)
- CVE-2026-42504HIGHMIME Header CPU Exhaustion Denial of Service – Patch Guidance