Python HTML Parser Denial-of-Service Vulnerability Due to Quadratic Complexity

Vulnerability

A denial-of-service vulnerability has been identified in the Python HTML parser's HTMLParser class, specifically in versions 3.9 through 3.14. This vulnerability arises from a worst-case quadratic complexity when the parser processes certain crafted malformed inputs. Such complexity can be exploited to amplify denial-of-service conditions, causing the parser to slow down significantly under specific scenarios.

Impact

Exploitation of this vulnerability leads to a denial-of-service condition, where the HTML parser becomes significantly slower, causing delays in processing that can disrupt normal application performance.

Reproduction

The vulnerability can be reproduced by using the HTMLParser class to parse specially crafted HTML inputs that exploit the quadratic complexity. This can be done by creating a test that feeds the parser with inputs designed to trigger the worst-case performance, such as nested tags or comments that the parser must process extensively.

Remediation

Users can upgrade to Python versions 3.15 or later, where this vulnerability has been addressed.

Added: Jun 17, 2025, 2:28 PM
Updated: Jun 17, 2025, 2:28 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
6.0
remediation
0.0
relevance
0.2
threat
4.8
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.