Executive brief
Mistune, a popular Python library for parsing Markdown text, is vulnerable to a denial-of-service attack. An attacker can provide a specially crafted Markdown document containing many repeated link definitions that causes the parser to consume excessive CPU resources. This can lead to application slowdowns or complete service outages when processing untrusted user input.
Technical details
Mistune's block_parser.py contains an algorithmic complexity vulnerability (CWE-407/CWE-1333) where reference-link definitions are handled with O(N²) time complexity. The root cause is that the parser fails to amortize the scan for definition lists, performing redundant forward scans and normalization for every candidate position. An attacker can exploit this by submitting a Markdown document with thousands of repeated reference keys (e.g., '[a]: u\n'), causing the CPU to peg for several seconds per request. This is reachable via the default create_markdown() configuration. The issue is fixed in version 3.3.0 by implementing a single forward pass for line classification.
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