HIGH 7.5

CVE-2026-59928: Mistune Markdown Parser Denial of Service via Reference-Link Complexity

Mistune, a widely-used Python Markdown parser library, contains a denial-of-service vulnerability in how it handles Markdown reference-link definitions. An attacker can craft a malicious Markdown document with numerous repeated or distinct reference links that forces the parser to perform excessive computational work, ultimately exhausting CPU resources and crashing or hanging applications that parse untrusted Markdown input. The vulnerability has been patched in version 3.3.0.

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, a Markdown document containing many repeated or distinct reference-link definitions causes quadratic work in src/mistune/block_parser.py and the ref_links environment dictionary handling, allowing denial of service through CPU exhaustion. This issue is fixed in version 3.3.0.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability stems from quadratic-time complexity in the reference-link parsing logic within src/mistune/block_parser.py and the ref_links environment dictionary. When Mistune encounters many reference-link definitions in a single document, the parser's algorithm exhibits O(n²) or worse behavior, causing CPU-bound denial of service. This is a classic algorithmic complexity issue (CWE-1333) compounded by improper resource validation (CWE-407). No authentication is required, the attack is network-accessible, and user interaction is not needed—any application accepting untrusted Markdown and using an affected Mistune version is exposed.

Business impact

Applications and services that parse user-supplied or third-party Markdown content using Mistune prior to 3.3.0 face availability risk. This includes documentation platforms, comment systems, content management systems, static site generators, and API services that render Markdown. An attacker can launch a denial-of-service attack by submitting a specially crafted Markdown document, causing the affected service to become unresponsive. The CVSS 7.5 HIGH severity reflects the broad attack surface and complete availability impact, though no confidentiality or integrity is compromised.

Affected systems

The mistune Python package versions prior to 3.3.0 are affected. Any application or library that depends on Mistune and parses untrusted Markdown is in scope. This includes web applications, documentation generators, chat/forum systems, and CI/CD pipelines that render Markdown from external sources. Organizations should inventory their Python environments and dependency trees to identify exposed services.

Exploitability

Exploitation is straightforward and requires no special privileges or user interaction. An attacker need only submit a Markdown document with numerous reference-link definitions to a vulnerable endpoint. There is no network complexity, no authentication bypass required, and the attack surface is broad. The vulnerability is immediately actionable for any service accepting Markdown input over HTTP/API. No exploit code is public at this time, but the conceptual attack is trivial for anyone familiar with algorithmic complexity attacks.

Remediation

Upgrade Mistune to version 3.3.0 or later. Organizations should prioritize patching for services that parse public or untrusted Markdown content. If an immediate upgrade is not feasible, restrict Markdown parsing to trusted sources only, implement rate limiting on Markdown submission endpoints, or deploy input validation to reject documents with excessive reference-link definitions. Monitor CPU usage on affected services for signs of exploitation.

Patch guidance

Apply the upgrade to Mistune 3.3.0 using your package manager (e.g., pip install --upgrade mistune>=3.3.0). Verify the patch by checking mistune.__version__ in your runtime environment. Test the upgrade in a staging environment first, as Markdown rendering behavior may have changed. Review the Mistune release notes to confirm no breaking changes affect your application. For containerized deployments, rebuild images with the patched version and redeploy.

Detection guidance

Monitor for excessive CPU usage on services that parse Markdown, especially on endpoints accepting user input. Review access logs for POST requests with unusually large Markdown payloads or repeated patterns of reference-link definitions. Implement Web Application Firewalls or reverse proxies to detect and rate-limit requests with malformed or suspiciously complex Markdown. Use application performance monitoring (APM) tools to alert on CPU spikes correlated with Markdown parsing. In source code, search for imports of mistune and verify all instances have been updated to 3.3.0 or later.

Why prioritize this

This vulnerability should be prioritized if your organization operates any public-facing services that accept Markdown input—documentation portals, support ticket systems, API comment endpoints, or collaborative platforms. The HIGH CVSS score, combined with ease of exploitation and immediate availability impact, makes this a credible near-term risk. Organizations with large user bases or external API surfaces should address this within days rather than weeks. If Markdown parsing is restricted to internal, trusted content, the risk is lower but should still be addressed during the next maintenance cycle.

Risk score, explained

The CVSS 3.1 score of 7.5 (HIGH) reflects: Network accessibility (AV:N) with no special privileges required (PR:N), no user interaction needed (UI:N), and high availability impact (A:H). The absence of confidentiality and integrity impact prevents a critical rating. The score accurately captures the real-world risk for applications parsing untrusted Markdown but underscores the attack's dependence on Markdown parsing being enabled. Organizations with Markdown parsing disabled or restricted to trusted sources may assign a lower contextual risk.

Frequently asked questions

What is a reference-link definition in Markdown?

A reference-link definition is a Markdown construct like [ref]: https://example.com that allows writers to define link targets separately from the link text. Markdown permits multiple definitions, including duplicates. Mistune's parser was not optimized for documents with many distinct or repeated definitions, allowing an attacker to exploit this inefficiency.

Does this vulnerability affect Mistune 2.x versions?

Yes, the vulnerability affects all versions prior to 3.3.0, including the 2.x branch. However, only version 3.3.0 and later contain the fix. Check your installed version with pip show mistune and upgrade accordingly.

Can I mitigate this without upgrading immediately?

Partial mitigation is possible: restrict Markdown parsing to internal or pre-vetted content, implement request size limits on endpoints accepting Markdown, or add a Web Application Firewall rule to reject requests with suspicious repetitive patterns. These measures reduce but do not eliminate risk; upgrading is the authoritative fix.

How long does exploitation take?

Exploitation depends on the document size and server resources. A moderately crafted document with thousands of reference links can exhaust CPU within seconds on a standard server. The attack is deterministic and repeatable, making it a reliable denial-of-service vector.

This analysis is provided for informational purposes to assist security professionals in risk assessment and remediation planning. The information herein is based on publicly available data as of the stated publication date. No warranty is made regarding the completeness or accuracy of this analysis. Organizations should verify all technical details, patch versions, and compatibility against vendor advisories and their own environments before taking action. SEC.co does not endorse any particular remediation approach and recommends consulting with your security and development teams to determine the best course of action for your infrastructure. Exploit code, proof-of-concept attacks, or detailed attack methodologies are not provided herein. Source: NVD (public-domain), retrieved 2026-08-17. Analysis generated by SEC.co (claude-haiku-4-5).