CVE-2024-41989
📋 TL;DR
This vulnerability in Django's floatformat template filter allows attackers to cause denial of service through memory exhaustion by providing specially crafted scientific notation numbers with large exponents. It affects Django applications using the vulnerable template filter with user-controlled input. All Django 5.0 before 5.0.8 and 4.2 before 4.2.15 installations are affected.
💻 Affected Systems
- Django
📦 What is this software?
Django by Djangoproject
Django by Djangoproject
⚠️ Risk & Real-World Impact
Worst Case
Complete service unavailability due to memory exhaustion, potentially requiring server restart and causing extended downtime.
Likely Case
Temporary service degradation or unavailability affecting specific endpoints using the floatformat filter with user input.
If Mitigated
Minimal impact if input validation prevents malicious scientific notation from reaching the filter.
🎯 Exploit Status
Exploitation is straightforward - attackers only need to send specially crafted scientific notation strings to endpoints using the floatformat filter. No authentication required.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Django 5.0.8 or 4.2.15
Vendor Advisory: https://www.djangoproject.com/weblog/2024/aug/06/security-releases/
Restart Required: Yes
Instructions:
1. Backup your Django application and database. 2. Update Django using pip: 'pip install Django==5.0.8' or 'pip install Django==4.2.15'. 3. Restart your Django application server. 4. Test critical functionality.
🔧 Temporary Workarounds
Input Validation for floatformat
allValidate and sanitize user input before passing to floatformat filter to reject scientific notation with large exponents.
Disable floatformat Filter
allRemove or disable usage of the floatformat template filter in templates if not essential.
🧯 If You Can't Patch
- Implement strict input validation to reject scientific notation strings with exponents exceeding reasonable bounds (e.g., > 1000).
- Deploy rate limiting and request filtering at the web server or WAF level to block suspicious patterns.
🔍 How to Verify
Check if Vulnerable:
Check Django version: 'python -m django --version'. If version is 5.0.x < 5.0.8 or 4.2.x < 4.2.15, you are vulnerable.
Check Version:
python -m django --version
Verify Fix Applied:
After patching, verify version shows 5.0.8 or 4.2.15. Test endpoints using floatformat with normal scientific notation to ensure functionality remains.
📡 Detection & Monitoring
Log Indicators:
- Unusual memory consumption spikes
- Process termination due to memory limits
- Repeated requests with scientific notation patterns
Network Indicators:
- HTTP requests containing scientific notation strings with large exponents (e.g., 1e999999)
SIEM Query:
source="web_logs" AND (uri="*floatformat*" OR params="*e[0-9]{5,}*")