oss-sec mailing list archives

Django 3.2.1, 3.1.9, and 2.2.21: CVE-2021-31542: Potential directory-traversal via uploaded files


From: Carlton Gibson <carlton.gibson () gmail com>
Date: Tue, 4 May 2021 10:58:23 +0200

https://www.djangoproject.com/weblog/2021/may/04/security-releases/ 
<https://www.djangoproject.com/weblog/2021/may/04/security-releases/>

In accordance with `our security release policy
<https://docs.djangoproject.com/en/dev/internals/security/>`_, the Django team
is issuing
`Django 3.2.1 <https://docs.djangoproject.com/en/dev/releases/3.2.1/>`_,
`Django 3.1.9 <https://docs.djangoproject.com/en/dev/releases/3.1.9/>`_, and
`Django 2.2.21 <https://docs.djangoproject.com/en/dev/releases/2.2.21/>`_.
These release addresses the security issue detailed below. We encourage all users of Django to upgrade as soon as 
possible.

CVE-2021-31542: Potential directory-traversal via uploaded files
================================================================

``MultiPartParser``, ``UploadedFile``, and ``FieldFile`` allowed
directory-traversal via uploaded files with suitably crafted file names.

In order to mitigate this risk, stricter basename and path sanitation is now
applied. Specifically, empty file names and paths with dot segments will be
rejected.

This issue has low severity, according to the Django security policy.

Affected supported versions
===========================

* Django main branch
* Django 3.2
* Django 3.1
* Django 2.2

Resolution
==========

Patches to resolve the issue have been applied to Django's main branch and to
the 3.2, 3.1, and 2.2 release branches. The patches may be obtained from the
following changesets:

* On the `main branch <https://github.com/django/django/commit/0b79eb36915d178aef5c6a7bbce71b1e76d376d3>`__
* On the `3.2 release branch <https://github.com/django/django/commit/c98f446c188596d4ba6de71d1b77b4a6c5c2a007>`__
* On the `3.1 release branch <https://github.com/django/django/commit/25d84d64122c15050a0ee739e859f22ddab5ac48>`__
* On the `2.2 release branch <https://github.com/django/django/commit/04ac1624bdc2fa737188401757cf95ced122d26d>`__

The following releases have been issued:

* Django 3.2.1 (`download Django 3.2.1 <https://www.djangoproject.com/m/releases/3.2/Django-3.2.1.tar.gz>`_ | `3.2.1 
checksums <https://www.djangoproject.com/m/pgp/Django-3.2.1.checksum.txt>`_)
* Django 3.1.9 (`download Django 3.1.9 <https://www.djangoproject.com/m/releases/3.1/Django-3.1.9.tar.gz>`_ | `3.1.9 
checksums <https://www.djangoproject.com/m/pgp/Django-3.1.9.checksum.txt>`_)
* Django 2.2.21 (`download Django 2.2.21 <https://www.djangoproject.com/m/releases/2.2/Django-2.2.21.tar.gz>`_ | 
`2.2.21 checksums <https://www.djangoproject.com/m/pgp/Django-2.2.21.checksum.txt>`_)

The PGP key ID used for these releases is Carlton Gibson: `E17DF5C82B4F9D00
<https://github.com/carltongibson.gpg>`_.

General notes regarding security reporting
==========================================

As always, we ask that potential security issues be reported via
private email to ``security () djangoproject com``, and not via Django's
Trac instance or the django-developers list. Please see `our security
policies <https://www.djangoproject.com/security/>`_ for further
information.


Current thread: