CVE-2024-27351 Regular expression denial-of-service in Django
Attackers can cause denial of service in Django applications via crafted strings triggering regex backtracking in text truncation utilities.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2024-27351?
CVE-2024-27351 is a medium-severity denial of service vulnerability in Djangoproject Django, published on 15 Mar 2024. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
In Django 3.2 before 3.2.25, 4.2 before 4.2.11, and 5.0 before 5.0.3, the django.utils.text.Truncator.words() method (with html=True) and the truncatewords_html template filter are subject to a potential regular expression denial-of-service attack via a crafted string. NOTE: this issue exists because of an incomplete fix for CVE-2019-14232 and CVE-2023-43665.
Weakness: CWE-1333
Which versions are affected by CVE-2024-27351?
8 open source packages ship an affected version, including django and Django. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
django Bitnami | From 3.2.0 | 3.2.25, 4.2.11, 5.0.3 |
django PyPI | From 3.2 | 3.2.25, 4.2.11, 5.0.3 |
django PyPI | From 3.2 | 3.2.25 |
django PyPI | From 4.2 | 4.2.11 |
django PyPI | From 5.0 | 5.0.3 |
Django PyPI | From 3.2 | 3.2.25 |
2 more packages
Django PyPI | From 4.2 | 4.2.11 |
Django PyPI | From 5.0 | 5.0.3 |
Linux distribution packages (16)
python-django Red Hat:openstack:17.1::el9 | All versions | 0:2.2.24-9.el9ost |
python3-django Red Hat:openstack:17.1::el9 | All versions | 0:2.2.24-9.el9ost |
python-Django SUSE:HPE Helion OpenStack 8 | All versions | 1.11.29-3.62.1 |
venv-openstack-horizon-hpe SUSE:HPE Helion OpenStack 8 | All versions | 12.0.5~dev6-14.56.1 |
python-Django SUSE:OpenStack Cloud 8 | All versions | 1.11.29-3.62.1 |
venv-openstack-horizon SUSE:OpenStack Cloud 8 | All versions | 12.0.5~dev6-14.56.1 |
python-Django1 SUSE:OpenStack Cloud 9 | All versions | 1.11.29-3.61.1 |
venv-openstack-horizon SUSE:OpenStack Cloud 9 | All versions | 14.1.1~dev11-4.53.1 |
python-Django SUSE:OpenStack Cloud Crowbar 8 | All versions | 1.11.29-3.62.1 |
python-Django1 SUSE:OpenStack Cloud Crowbar 9 | All versions | 1.11.29-3.61.1 |
python-Django SUSE:Package Hub 15 SP5 | All versions | 2.2.28-bp155.7.9.1 |
python-Django1 SUSE:Package Hub 15 SP5 | All versions | 1.11.29-bp155.4.9.1 |
python-Django openSUSE:Leap 15.5 | All versions | 2.0.7-150000.1.17.1 |
python-Django openSUSE:Leap 15.5 | All versions | 2.2.28-bp155.7.9.1 |
python-Django1 openSUSE:Leap 15.5 | All versions | 1.11.29-bp155.4.9.1 |
python-Django openSUSE:Tumbleweed | All versions | 4.2.11-1.1 |
Products include Djangoproject Django.
How do I fix CVE-2024-27351?
Upgrade django to a fixed version for your release line: 3.2.25, 4.2.11 or 5.0.3.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
Is CVE-2024-27351 being exploited?
There is no known exploitation of CVE-2024-27351 in the wild and no public exploit code.
Other vulnerabilities in Djangoproject Django
- CVE-2026-4277 Privilege abuse in GenericInlineModelAdmin
- CVE-2024-53908 Django SQL injection in HasKey(lhs, rhs) on Oracle
- CVE-2024-42005 Django SQL injection vulnerability
- CVE-2023-31047 Django bypasses validation when using one form field to upload multiple files
- CVE-2022-34265 Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection
Sources
Also known as BIT-django-2024-27351, CLSA-2025-1754352700, DEBIAN-CVE-2024-27351, GHSA-vm8q-m57g-pff3, MGASA-2024-0075, OESA-2024-1254 and 11 more.