CVE-2022-23833

7.5 HIGH

📋 TL;DR

CVE-2022-23833 is a denial-of-service vulnerability in Django's MultiPartParser that allows attackers to cause infinite loops by submitting specially crafted multipart form data. This affects Django applications that handle file uploads or multipart form submissions. All Django deployments using vulnerable versions are potentially affected.

💻 Affected Systems

Products:
  • Django
Versions: Django 2.2 before 2.2.27, Django 3.2 before 3.2.12, Django 4.0 before 4.0.2
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects applications using Django's MultiPartParser, typically for file uploads or multipart form handling. Applications not processing multipart data are not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete service unavailability due to resource exhaustion (CPU/memory) from infinite loops, potentially leading to application crashes and extended downtime.

🟠

Likely Case

Temporary service degradation or unavailability for affected endpoints, requiring manual intervention to restart services.

🟢

If Mitigated

Minimal impact with proper request filtering, rate limiting, and monitoring in place to detect and block malicious requests.

🌐 Internet-Facing: HIGH - Internet-facing Django applications are directly exposed to exploitation attempts from any remote attacker.
🏢 Internal Only: MEDIUM - Internal applications are still vulnerable but attack surface is reduced to authenticated internal users.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted multipart requests to vulnerable endpoints. The vulnerability is well-documented with public proof-of-concept available.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Django 2.2.27, 3.2.12, or 4.0.2

Vendor Advisory: https://docs.djangoproject.com/en/4.0/releases/security/

Restart Required: Yes

Instructions:

1. Identify Django version using 'python -m django --version'. 2. Upgrade to patched version: 'pip install --upgrade django==2.2.27' or 'pip install --upgrade django==3.2.12' or 'pip install --upgrade django==4.0.2'. 3. Restart all Django processes and web servers. 4. Test file upload functionality.

🔧 Temporary Workarounds

Request Size Limiting

all

Configure web server or Django to limit multipart request sizes to prevent exploitation attempts

# Nginx: client_max_body_size 10M;
# Apache: LimitRequestBody 10485760
# Django: DATA_UPLOAD_MAX_MEMORY_SIZE = 10485760

Request Timeout Configuration

all

Set lower timeout values for request processing to limit impact of infinite loops

# Nginx: proxy_read_timeout 30s;
# Gunicorn: --timeout 30
# uWSGI: --harakiri 30

🧯 If You Can't Patch

  • Implement WAF rules to block suspicious multipart requests with abnormal patterns
  • Deploy rate limiting on file upload endpoints and monitor for abnormal request patterns

🔍 How to Verify

Check if Vulnerable:

Check Django version: 'python -c "import django; print(django.get_version())"' and compare against affected ranges.

Check Version:

python -m django --version

Verify Fix Applied:

Verify version is 2.2.27, 3.2.12, or 4.0.2 or higher. Test file upload functionality works normally.

📡 Detection & Monitoring

Log Indicators:

  • Multiple long-running requests to file upload endpoints
  • High CPU usage on Django workers
  • Request timeouts on multipart endpoints

Network Indicators:

  • Abnormally large multipart requests
  • Multiple rapid requests to upload endpoints
  • Requests with malformed multipart boundaries

SIEM Query:

source="django.log" AND ("POST /upload" OR "multipart/form-data") AND duration>30s

🔗 References

📤 Share & Export