Django security releases issued: 3.2.1, 3.1.9, and 2.2.21

Posted by Carlton Gibson on May 4, 2021

In accordance with our security release policy, the Django team is issuing Django 3.2.1, Django 3.1.9, and Django 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.

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

Thank you to Jasu Viding for the report.

Affected supported versions

  • Django main branch
  • Django 3.2
  • Django 3.1
  • Django 2.2


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:

The following releases have been issued:

The PGP key ID used for these releases is Carlton Gibson: E17DF5C82B4F9D00.

General notes regarding security reporting

As always, we ask that potential security issues be reported via private email to, and not via Django's Trac instance or the django-developers list. Please see our security policies for further information.

Back to Top