python-markdownify Memory Exhaustion Vulnerability via Oversized Headline Tags
Vulnerability
A memory consumption vulnerability has been identified in python-markdownify (markdownify) versions prior to 0.14.1. The issue arises from the library's handling of excessively large headline prefixes, such as <h9999999>, in addition to the standard <h1> through <h6> tags. This flaw can lead to rapid resource exhaustion, causing machines to freeze due to 100% memory usage within seconds. The problem has been reproduced using the atheris library, and could potentially be exploited by feeding large headline tags into a server, according to the issue description on GitHub.
Impact
Exploitation of this vulnerability can lead to a MemoryError, causing the application to crash. In severe cases, it can freeze the entire machine, requiring a manual reboot to recover.
Reproduction
The vulnerability can be reproduced by using the markdownify function to convert HTML containing oversized heading tags, such as <h5555555555>, into markdown. This can be done within a Python environment where python-markdownify version 0.13.1 is installed, using the atheris library to simulate the issue.
Remediation
Users are advised to update python-markdownify to version 0.14.1 or later, where this vulnerability has been fixed.
Vulnerability Rating
Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.
