Executive brief
Mistune is a popular Python library used to convert Markdown text into HTML. A vulnerability in its parsing engine allows an attacker to submit specially crafted text that causes the server to consume excessive CPU resources. This can lead to a denial-of-service (DoS) condition, making the application or website unresponsive to legitimate users.
Technical details
The vulnerability is an algorithmic complexity DoS (CWE-407) located in `src/mistune/inline_parser.py`. The parser uses a quadratic-time O(N²) approach for emphasis parsing where it retries a forward scan for a matching closing marker from every potential opening position. An attacker can exploit this by providing a payload with thousands of well-formed emphasis pairs (e.g., `**x**` repeated 8,000 times), causing the CPU to peg for several seconds per request. This affects the default configuration of Mistune without requiring any plugins. The issue is resolved in version 3.3.0 by implementing a more efficient parsing strategy or capping the number of tracked markers.
Affected products
- lepture mistune < 3.3.0
Timeline
- 2026-06-21: disclosed
- 2026-07-08: advisory: NVD publication date
- 2026-07-20: patched: GitHub Advisory reviewed and updated