Denial-of-Service Vulnerability in Python-Django: urlize() and urlizetrunc() Filters
Summary
DEBIAN-CVE-2024-41990: An issue was discovered in Django 5.0 before 5.0.8 and 4.2 before 4.2.15. Affects python-django versions < 3:4.2.15-1. Fixed in 3:4.2.15-1. How to fix ↓
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
Python-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, templating engine, and built-in security features. However, it is susceptible to vulnerabilities that can affect its performance and security, such as the one identified in this report.
Vulnerability Detail
An issue was discovered in Django versions 5.0 before 5.0.8 and 4.2 before 4.2.15. The vulnerability lies in the urlize() and urlizetrunc() template filters, which can be exploited through a denial-of-service attack. Attackers can send very large inputs containing specific sequences of characters, leading to potential service disruption. This vulnerability highlights the importance of input validation and handling in web applications.
How To Fix
Minimum fixed version
3:4.2.15-1
This is the first release that contains the fix.
sudo apt-get install --only-upgrade python-django
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can limit the size of inputs processed by the urlize() and urlizetrunc() filters in your templates. Implement input validation to reject excessively large inputs before they reach these filters.
Conclusion
The vulnerability in Python-Django's urlize() and urlizetrunc() filters poses a significant risk of denial-of-service attacks through large inputs. It is crucial for developers to update to the patched version and implement input validation as a preventive measure.
See every vulnerability recorded for python-django →
FAQ
The vulnerability allows for a denial-of-service attack via large inputs to the urlize() and urlizetrunc() filters in Django.
Django versions 5.0 before 5.0.8 and 4.2 before 4.2.15 are affected by this vulnerability.
You can use Vulert, which monitors and alerts for open-source vulnerabilities in your software. Check your application against this vulnerability using the Vulert playground at Vulert Scanner.
Implement input validation to limit the size of inputs processed by the vulnerable filters as a temporary measure.
Yes, the permanent fix is to update to the patched version of Django, specifically 3:4.2.15-1 or later.
References
Related vulnerabilities
Recent vulnerabilities recorded for python-django.