CVE-2021-31542 Path Traversal in Django
Attackers can exploit directory traversal in Django's file upload handling to read or modify arbitrary files on the server.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-31542?
CVE-2021-31542 is a high-severity path traversal vulnerability in Debian Debian Linux, published on 5 May 2021. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
In Django 2.2 before 2.2.21, 3.1 before 3.1.9, and 3.2 before 3.2.1, MultiPartParser, UploadedFile, and FieldFile allowed directory traversal via uploaded files with suitably crafted file names.
Weakness: CWE-22
Which versions are affected by CVE-2021-31542?
8 open source packages ship an affected version, including django and Django. It affects 3 products.
| Package | Affected | Fixed in |
|---|---|---|
django Bitnami | From 2.2.0 | 2.2.21, 3.1.9, 3.2.1 |
django PyPI | From 2.2 | 2.2.21, 3.1.9, 3.2.1 |
django PyPI | From 2.2 | 2.2.21 |
django PyPI | From 3.0 | 3.1.9 |
django PyPI | From 3.2 | 3.2.1 |
Django PyPI | From 2.2 | 2.2.21 |
2 more packages
Django PyPI | From 3.0 | 3.1.9 |
Django PyPI | From 3.2 | 3.2.1 |
Products include Debian Debian Linux, Djangoproject Django, Fedoraproject Fedora.
How do I fix CVE-2021-31542?
Upgrade django to a fixed version for your release line: 2.2.21, 3.1.9 or 3.2.1.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-31542 being exploited?
There is no known exploitation of CVE-2021-31542 in the wild and no public exploit code.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as BIT-django-2021-31542, DEBIAN-CVE-2021-31542, DLA-2651-1, GHSA-rxjp-mfm9-w4wr, PYSEC-2021-7, UBUNTU-CVE-2021-31542 and 2 more.