Django security releases issued: 4.2.6, 4.1.12, and 3.2.22
In accordance with our security release policy, the Django team is issuing Django 4.2.6, Django 4.1.12, and Django 3.2.22. These releases address the security issue detailed below. We encourage all users of Django to upgrade as soon as possible.
CVE-2023-43665: Denial-of-service possibility in django.utils.text.Truncator
Following the fix for CVE-2019-14232, the regular expressions used in the implementation of django.utils.text.Truncator’s chars() and words() methods (with html=True) were revised and improved. However, these regular expressions still exhibited linear backtracking complexity, so when given a very long, potentially malformed HTML input, the evaluation would still be slow, leading to a potential denial of service vulnerability.
The chars() and words() methods are used to implement the truncatechars_html and truncatewords_html template filters, which were thus also vulnerable.
The input processed by Truncator, when operating in HTML mode, has been limited to the first five million characters in order to avoid potential performance and memory issues.
Thanks Wenchao Li of Alibaba Group for the report.
This issue has severity "moderate" according to the Django security policy.
Affected supported versions
- Django main branch
- Django 5.0 (currently at pre-release alpha status)
- Django 4.2
- Django 4.1
- Django 3.2
Resolution
Patches to resolve the issue have been applied to Django's main branch and the 5.0, 4.2, 4.1, and 3.2 release branches. The patches may be obtained from the following changesets:
- On the main branch
- On the 5.0 release branch
- On the 4.2 release branch
- On the 4.1 release branch
- On the 3.2 release branch
The following releases have been issued:
- Django 4.2.6 (download Django 4.2.6 | 4.2.6 checksums)
- Django 4.1.12 (download Django 4.1.12 | 4.1.12 checksums)
- Django 3.2.22 (download Django 3.2.22 | 3.2.22 checksums)
The PGP key ID used for this release is Natalia Bidart: 2EE82A8D9470983E
General notes regarding security reporting
As always, we ask that potential security issues be reported via private email to security@djangoproject.com, and not via Django's Trac instance or the django-developers list. Please see our security policies for further information.