CVE-2019-25781
Algorithmic complexity bug in Python‑Markdown link parsing causing CPU exhaustion.
- CVSS 8.7
- CWE-407
- Resource Management
- Remote
Python-Markdown 3.0 through 3.11.2 contains an algorithmic complexity vulnerability in inline link parsing that allows remote attackers to exhaust CPU through unmatched brackets. Attackers can submit short Markdown containing repeated [ or ![ characters, forcing LinkInlineProcessor.getText() and getLink() into quadratic scans that keep workers busy for minutes.
- CWE
- CWE-407
- CVSS base score
- 8.7
- Published
- 2026-10-29
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Python-Markdown
- Fixed by upgrading
- Yes
Solution
Upgrade Python‑Markdown to version 3.12.0 (or later), where the inline‑link parsing complexity issue is fixed.
Vulnerable code sample
import markdown
def render(md_text):
# VULNERABLE: quadratic link parsing on unmatched brackets
return markdown.markdown(md_text)Patched code sample
import re
import markdown
def render(md_text):
# FIX: limit consecutive '[' or '![' to avoid pathological scans
sanitized = re.sub(r'(\[+|\!\[+){5,}', lambda m: m.group(0)[:4], md_text)
return markdown.markdown(sanitized)Cite this entry
@misc{vaitp:cve201925781,
title = {{Algorithmic complexity bug in Python‑Markdown link parsing causing CPU exhaustion.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2019-25781},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2019-25781/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
