You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Worst case quadratic complexity in HTMLParser #135462
The problem is that when the parser found the beginning of an element (tag, commet, etc), it looked for its end (this has linear complexity), and when it didn't find it, it emitted the beginning as data and started with the next "<". And it could find a new beginning in the middle of an incomplete element, so it continued over and over again, making the total complexity quadratic. There are many ways to trigger this.
The HTML5 standard specifies the behavior for unexpectedly terminated elements, it does not require backtracking, so the total complexity is linear. #135464 implements this.
Activity
pythongh-135462: Fix quadratic complexity in processing special input…
pythongh-135462: Fix quadratic complexity in processing special input…
gh-135462: Fix quadratic complexity in processing special input in HT…
pythongh-135462: Fix quadratic complexity in processing special input…
pythongh-135462: Fix quadratic complexity in processing special input…
14 remaining items
serhiy-storchaka commentedon Jul 4, 2025
Some more information.
The issue was reported by Jake Howard on behalf of the Django Security team.
The problem is that when the parser found the beginning of an element (tag, commet, etc), it looked for its end (this has linear complexity), and when it didn't find it, it emitted the beginning as data and started with the next "<". And it could find a new beginning in the middle of an incomplete element, so it continued over and over again, making the total complexity quadratic. There are many ways to trigger this.
The HTML5 standard specifies the behavior for unexpectedly terminated elements, it does not require backtracking, so the total complexity is linear. #135464 implements this.
pythongh-135462: Fix quadratic complexity in processing special input…
[3.9] pythongh-135462: Fix quadratic complexity in processing special…
pythongh-135462: Fix quadratic complexity in processing special input…
pythongh-135462: Fix quadratic complexity in processing special input…
CVE-2025-6069 python/cpython#135462
CVE-2025-6069 python/cpython#135462
[CVE-2025-6069] fix quadratic complexity in processing special input …
[CVE-2025-6069] fix quadratic complexity in processing special input …
[CVE-2025-6069] fix quadratic complexity in processing special input …
[CVE-2025-6069] fix quadratic complexity in processing special input …
fix: pin Python 3.12.15 repo-wide for CVE-2025-6069 (HTMLParser quadr…
CVE-2025-6069 python/cpython#135462