Executive brief
A vulnerability in Python's standard HTML parsing library can allow an attacker to crash or slow down an application by sending specially crafted, incomplete web data. This component is commonly used by web scrapers and servers to process HTML content. An exploit could lead to a total service outage (Denial of Service) by exhausting the server's processing power.
Technical details
The incremental HTML parser (html.parser.HTMLParser) in CPython contains a flaw where processing uncontrolled data with repeated unterminated markup declarations leads to quadratic complexity. When an unterminated construct, such as a tag or comment, spans multiple feed() calls, the parser repeatedly rescans the growing buffer and performs inefficient string concatenations. An unauthenticated remote attacker can exploit this by sending malicious HTML fragments, causing excessive CPU consumption and a Denial of Service. The fix involves accumulating data in a list and only joining/parsing once a sufficient threshold is met to avoid the quadratic overhead. Patches have been backported to versions 3.10 through 3.15.
Affected products
- Python Software Foundation CPython < 3.16.0
Timeline
- 2026-07-04: disclosed: Issue reported and PR opened on GitHub
- 2026-07-04: patched: Fix merged into CPython main branch
- 2026-07-09: advisory: CVE-2026-15308 published