CVE-2021-32052 Header injection possible in Django
Header injection possible in Django applications using URLValidator with newlines in HTTP responses, requiring specific application logic to exploit.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2021-32052?
CVE-2021-32052 is a medium-severity vulnerability in Djangoproject Django, published on 6 May 2021. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
In Django 2.2 before 2.2.22, 3.1 before 3.1.10, and 3.2 before 3.2.2 (with Python 3.9.5+), URLValidator does not prohibit newlines and tabs (unless the URLField form field is used). If an application uses values with newlines in an HTTP response, header injection can occur. Django itself is unaffected because HttpResponse prohibits newlines in HTTP headers.
Weakness: CWE-79
Which versions are affected by CVE-2021-32052?
8 open source packages ship an affected version, including django and Django. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
django Bitnami | From 2.2.0 | 2.2.22, 3.1.10, 3.2.2 |
django PyPI | From 2.2 | 2.2.22, 3.1.10, 3.2.2 |
django PyPI | From 2.2 | 2.2.22 |
django PyPI | From 3.1 | 3.1.10 |
django PyPI | From 3.2 | 3.2.2 |
Django PyPI | From 2.2 | 2.2.22 |
2 more packages
Django PyPI | From 3.1 | 3.1.10 |
Django PyPI | From 3.2 | 3.2.2 |
Products include Djangoproject Django, Fedoraproject Fedora.
How do I fix CVE-2021-32052?
Upgrade django to a fixed version for your release line: 2.2.22, 3.1.10 or 3.2.2.
Is CVE-2021-32052 being exploited?
There is no known exploitation of CVE-2021-32052 in the wild and no public exploit code.
Other vulnerabilities in Djangoproject Django
- CVE-2026-4277 Privilege abuse in GenericInlineModelAdmin
- CVE-2024-53908 Django SQL injection in HasKey(lhs, rhs) on Oracle
- CVE-2024-42005 Django SQL injection vulnerability
- CVE-2023-31047 Django bypasses validation when using one form field to upload multiple files
- CVE-2022-34265 Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection
Sources
Also known as BIT-django-2021-32052, DEBIAN-CVE-2021-32052, GHSA-qm57-vhq3-3fwf, PYSEC-2021-8, UBUNTU-CVE-2021-32052.