CVE-2024-38875: Django Denial of Service Vulnerability via urlize and urlizetrunc
Summary
CVE-2024-38875: An issue was discovered in Django 4.2 before 4.2.14 and 5.0 before 5.0.7. Affects django across 2 version ranges.
>= 4.2.0, < 4.2.14
>= 5.0.0, < 5.0.7
Fixed in 4.2.14 or 5.0.7, depending on the release line you run. How to fix ↓
Also tracked for
- django · PyPI
- python-django · Debian:11
- django · PyPI
The same CVE-2024-38875 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM, authentication, and URL routing. However, certain versions of Django are vulnerable to a denial of service attack due to improper handling of inputs with a large number of brackets in the urlize and urlizetrunc functions.
Vulnerability Detail
The vulnerability identified as CVE-2024-38875 affects Django versions 4.2 before 4.2.14 and 5.0 before 5.0.7. It arises from the urlize and urlizetrunc functions, which can be exploited by providing inputs containing an excessive number of brackets. This can lead to a denial of service, as the application may become unresponsive when processing such inputs. The issue is particularly concerning for applications that rely on user-generated content, as malicious users could exploit this vulnerability to disrupt service availability.
How To Fix
Fixed versions by release line
The minimum fixed version depends on the release line you run.
-
>= 4.2.0, < 4.2.144.2.14 -
>= 5.0.0, < 5.0.75.0.7
Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →
Workaround
As a temporary workaround, you can implement input validation to restrict the number of brackets allowed in user inputs before they are processed by urlize or urlizetrunc. This can help mitigate the risk of denial of service attacks until the package is updated.
Conclusion
The CVE-2024-38875 vulnerability in Django poses a significant risk of denial of service attacks through the urlize and urlizetrunc functions. It is crucial to update to the latest patched versions to mitigate this risk. Implementing input validation can serve as a temporary measure while awaiting updates.
See every vulnerability recorded for django →
FAQ
CVE-2024-38875 is a vulnerability in Django that allows for a potential denial of service attack via the urlize and urlizetrunc functions when they receive inputs with a large number of brackets.
Django versions 4.2 before 4.2.14 and 5.0 before 5.0.7 are affected by this vulnerability.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without requiring any signup.
If you cannot update Django immediately, implement input validation to limit the number of brackets in user inputs as a temporary workaround.
The main consequence of this vulnerability is a denial of service, which can render your application unresponsive and affect user experience.
Related vulnerabilities
Recent vulnerabilities recorded for django.