CVE-2024-27351 Regular expression denial-of-service in Django

Medium 5.3 Published Updated

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.

PackageAffectedFixed in
django BitnamiFrom 3.2.03.2.25, 4.2.11, 5.0.3
django PyPIFrom 3.23.2.25, 4.2.11, 5.0.3
django PyPIFrom 3.23.2.25
django PyPIFrom 4.24.2.11
django PyPIFrom 5.05.0.3
Django PyPIFrom 3.23.2.25
2 more packages
Django PyPIFrom 4.24.2.11
Django PyPIFrom 5.05.0.3
Linux distribution packages (16)
python-django Red Hat:openstack:17.1::el9All versions0:2.2.24-9.el9ost
python3-django Red Hat:openstack:17.1::el9All versions0:2.2.24-9.el9ost
python-Django SUSE:HPE Helion OpenStack 8All versions1.11.29-3.62.1
venv-openstack-horizon-hpe SUSE:HPE Helion OpenStack 8All versions12.0.5~dev6-14.56.1
python-Django SUSE:OpenStack Cloud 8All versions1.11.29-3.62.1
venv-openstack-horizon SUSE:OpenStack Cloud 8All versions12.0.5~dev6-14.56.1
python-Django1 SUSE:OpenStack Cloud 9All versions1.11.29-3.61.1
venv-openstack-horizon SUSE:OpenStack Cloud 9All versions14.1.1~dev11-4.53.1
python-Django SUSE:OpenStack Cloud Crowbar 8All versions1.11.29-3.62.1
python-Django1 SUSE:OpenStack Cloud Crowbar 9All versions1.11.29-3.61.1
python-Django SUSE:Package Hub 15 SP5All versions2.2.28-bp155.7.9.1
python-Django1 SUSE:Package Hub 15 SP5All versions1.11.29-bp155.4.9.1
python-Django openSUSE:Leap 15.5All versions2.0.7-150000.1.17.1
python-Django openSUSE:Leap 15.5All versions2.2.28-bp155.7.9.1
python-Django1 openSUSE:Leap 15.5All versions1.11.29-bp155.4.9.1
python-Django openSUSE:TumbleweedAll versions4.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.

All Djangoproject Django vulnerabilities

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.

Is CVE-2024-27351 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free