A vulnerability classified as CVE-2024-56374 has been discovered in Django, a popular Python web framework. This issue affects versions 5.1 before 5.1.5, 5. before 5..11, and 4.2 before 4.2.18. The vulnerability exists in the IPv6 validation process, where a lack of upper-bound limit enforcement on input strings can potentially lead to a denial-of-service (DoS) attack.
Affected Components
The vulnerability affects the undocumented and private functions clean_ipv6_address and is_valid_ipv6_address in Django. Additionally, the django.forms.GenericIPAddressField form field is also impacted. However, the django.db.models.GenericIPAddressField model field remains unaffected.
Original References
The official Django security advisory containing this CVE can be found here. For a more in-depth understanding of this vulnerability, refer to the Django documentation and the associated public vulnerability disclosure here.
Exploit Details
The vulnerability might be exposed when performing IPv6 validation on user-provided input. For example, an attacker may input an exceptionally long string into a vulnerable Django form field, which could lead to a DoS attack. The DoS attack occurs when the server must process this large string, causing high CPU usage and eventually crashing the server, rendering it unusable.
The vulnerable functions can be found in Django's source code
def clean_ipv6_address(ip_str, unpack_ipv4=False, error_message=None):
try:
return _sanitize_ipv6_address(ip_str, unpack_ipv4)
except ValueError:
raise ValidationError(error_message, code='invalid')
def is_valid_ipv6_address(ip_str):
try:
_sanitize_ipv6_address(ip_str)
return True
except ValueError:
return False
Mitigation Measures
To mitigate this issue, users are encouraged to update their Django software to the latest version. Specifically, upgrade to Django 5.1.5, Django 5..11, or Django 4.2.18, which contain patches for this CVE.
To update your Django project, modify your requirements.txt file to include the updated version of Django and then use pip or other package managers to install the update:
Django>=5.1.5
# OR
Django>=5..11
# OR
Django>=4.2.18
Then, run the following command
$ pip install -r requirements.txt
Conclusion
CVE-2024-56374 is a potential DoS vulnerability in Django due to the lack of an upper-bound limit on strings during the IPv6 validation process. Updating Django to the latest version is crucial to ensure the security of your web application. Stay diligent and keep your software up-to-date to prevent potential attacks and vulnerabilities.
Timeline
Published on: 01/14/2025 19:15:32 UTC
Last modified on: 01/23/2025 18:15:32 UTC