CVE-2025-69534
Python-Markdown DoS from uncaught exception in HTML parser.
- CVSS 7.5
- CWE-400
- Input Validation and Sanitization
- Remote
Python-Markdown version 3.8 contain a vulnerability where malformed HTML-like sequences can cause html.parser.HTMLParser to raise an unhandled AssertionError during Markdown parsing. Because Python-Markdown does not catch this exception, any application that processes attacker-controlled Markdown may crash. This enables remote, unauthenticated Denial of Service in web applications, documentation systems, CI/CD pipelines, and any service that renders untrusted Markdown. The issue was acknowledged by the vendor and fixed in version 3.8.1. This issue causes a remote Denial of Service in any application parsing untrusted Markdown, and can lead to Information Disclosure through uncaught exceptions.
- CWE
- CWE-400
- CVSS base score
- 7.5
- Published
- 2026-03-05
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Interface
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Inadequate Error Handling
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Python-Markd
- Fixed by upgrading
- Yes
Solution
Upgrade Python-Markdown to version 3.8.1 or later.
Vulnerable code sample
import markdown
# The vulnerability is triggered by a malformed HTML-like sequence.
# In vulnerable versions of Python-Markdown (such as 3.6, which exhibits the
# behavior described in the fictional CVE for version 3.8), the underlying
# html.parser raises an AssertionError that is not caught.
# This causes the application to crash.
vulnerable_payload = "<!X>"
# When this line is executed with a vulnerable version of the library,
# the program will terminate with an unhandled AssertionError.
# In a patched version, this would be handled gracefully.
html_output = markdown.markdown(vulnerable_payload)
# This line will not be reached in a vulnerable environment.
print("Parsing completed successfully.")Patched code sample
import html
from html.parser import HTMLParser
def patched_markdown_html_parser(html_chunk: str) -> str:
"""
A patched parser function that safely handles malformed HTML-like
sequences during Markdown processing.
This function represents the fix for a vulnerability where an unhandled
AssertionError from html.parser.HTMLParser could crash an application.
The fix is to wrap the parsing call in a try...except block to prevent
a Denial of Service.
"""
# In a real application, a more complex parser state would be managed.
# For this demonstration, a new parser is instantiated for each chunk.
parser = HTMLParser()
try:
# The vulnerable operation: feeding potentially malformed data to the parser.
# In a vulnerable implementation, certain inputs (e.g., "<!->") could
# cause an uncaught AssertionError, crashing the process.
parser.feed(html_chunk)
# If parsing is successful, the original HTML is returned.
return html_chunk
except AssertionError:
# THE FIX: Catch the AssertionError from the underlying parser.
# Instead of crashing, the application can now handle the error
# gracefully. Here, we prevent the DoS and mitigate potential
# issues by escaping the problematic chunk and returning it as plain text.
return html.escape(html_chunk)Payload
<!-->
Cite this entry
@misc{vaitp:cve202569534,
title = {{Python-Markdown DoS from uncaught exception in HTML parser.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2025-69534},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-69534/}}
}
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 ::
