cve.bz

CVE-2021-31542 Path traversal

7.5 highEPSS 5.3%Fix available

High (7.5). EPSS 5.3% estimated probability of exploitation activity in the next 30 days. Fixed in django 2.2.21, 3.1.9, 3.2.1.

On this page
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.

Severity

CVSS 3.1

7.5 high
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
EPSS
5.3% (unchanged from 5.3% a week ago; 5.3% 30 days ago) estimated probability of exploitation activity in the next 30 days; 93rd percentile. Scored 2026-11-22. A forecast for this CVE across the internet, not for your own systems.
CWE
CWE-22 Improper Limitation of a Pathname to a Restricted Directory (Path traversal)
OWASP Top 10
A01:2025 Broken Access Control
Published
Modified
NVD analysis
Analyzed, since modified
Record from
the NVD, synced

Fix and patched versions

Ask an AI about this CVE

Show the promptExplain CVE-2021-31542 for an engineer deciding whether to act. Use https://cve.bz/api/public/cves/CVE-2021-31542?via=ask-ai-copy and https://cve.bz/cve/CVE-2021-31542?via=ask-ai-copy as the source of truth: what is affected and which versions fix it, whether it is in CISA KEV, public exploits, and its EPSS (an internet-wide 30-day estimate of exploitation activity, not a forecast for my systems). If they give no fixed versions, use the CVE record https://cveawg.mitre.org/api/cve/CVE-2021-31542 or the vendor advisory, not third-party mirrors. Tell me how to check whether I am affected and how to verify a fix. Cite the sources and say where they are uncertain.

Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this CVE's id and public links.

Affected

Versions

From the NVD's CPE matches.

ProductAffected
djangoproject:djangofrom 2.2 before 2.2.21
djangoproject:djangofrom 3.1 before 3.1.9
djangoproject:djangofrom 3.2 before 3.2.1
debian:debian_linux9.0
fedoraproject:fedora34
fedoraproject:fedora35

Packages (OSV)

AdvisoryEcosystemPackageAffectedFixed in
GHSA-rxjp-mfm9-w4wrPyPIdjango>=2.2 <2.2.212.2.21
GHSA-rxjp-mfm9-w4wrPyPIdjango>=3.0 <3.1.93.1.9
GHSA-rxjp-mfm9-w4wrPyPIdjango>=3.2 <3.2.13.2.1
PYSEC-2021-7PyPIdjango>=2.2 <2.2.21
>=3.1 <3.1.9
>=3.2 <3.2.1
2.2.21, 3.1.9, 3.2.1

Linux distributions

DistributionReleasePackageFixed inAdvisory
Debian9python-django1:1.10.7-2+deb9u13DLA-2651-1
Debian10python-django1:1.11.29-1+deb10u11DLA-3744-1
Debian12, 13, 14python-django2:2.2.21-1DEBIAN-CVE-2021-31542
Ubuntu18.04:LTSpython-django1:1.11.11-1ubuntu1.13UBUNTU-CVE-2021-31542 USN-4932-1
Ubuntu20.04:LTSpython-django2:2.2.12-1ubuntu0.6UBUNTU-CVE-2021-31542 USN-4932-1
UbuntuPro:14.04:LTSpython-django1.6.11-0ubuntu1.3+esm3UBUNTU-CVE-2021-31542 USN-4932-2
UbuntuPro:16.04:LTSpython-django1.8.7-1ubuntu5.15+esm1UBUNTU-CVE-2021-31542 USN-4932-2
Red Hatopenstack:16.1::el8python-django20, python3-django20, python-django20-bash-completion0:2.0.13-16.el8ost.1RHSA-2021:5070
Red Hatsatellite:6.10::el7candlepin0:4.0.9-1.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7satellite0:6.10.0-3.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7tfm-rubygem-activerecord-session_store0:2.0.0-1.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7tfm-rubygem-addressable0:2.8.0-1.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7tfm-rubygem-puma0:5.3.2-1.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7tfm-rubygem-rails, tfm-rubygem-actionpack0:6.0.3.7-1.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7, satellite_capsule:6.10::el7foreman0:2.5.2.17-2.el7satRHSA-2021:4702
Red Hatsatellite:6.10::el7, satellite_capsule:6.10::el7python-aiohttp0:3.7.4-1.el7pcRHSA-2021:4702
Red Hatsatellite:6.10::el7, satellite_capsule:6.10::el7python-ecdsa, python3-ecdsa0:0.13.3-2.el7pcRHSA-2021:4702
Red Hatsatellite:6.10::el7, satellite_capsule:6.10::el7python-pyyaml, python3-pyyaml0:5.4.1-1.el7pcRHSA-2021:4702
Red Hatsatellite:6.10::el7, satellite_capsule:6.10::el7python-urllib3, python3-urllib30:1.26.5-1.el7pcRHSA-2021:4702
3 more for Red Hat in the JSON and on Red Hat's page.
SUSEHPE Helion OpenStack 8documentation-hpe-helion-openstack-user, documentation-hpe-helion-openstack-planning, documentation-hpe-helion-openstack-security and 3 more8.20210512-1.32.5SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8venv-openstack-horizon-hpe12.0.5~dev6-14.36.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8ardana-cobbler8.0+git.1614096566.e8c2b27-3.44.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-aodh5.1.1~dev7-12.32.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-barbican5.0.2~dev3-12.33.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-ceilometer9.0.8~dev7-12.30.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-cinder11.2.3~dev29-14.34.2SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-designate5.0.3~dev7-12.31.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-freezer5.0.0.0~xrc2~dev2-10.28.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-glance15.0.3~dev3-12.31.3SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-heat9.0.8~dev22-12.33.2SUSE-SU-2021:2554-1
SUSEHPE Helion OpenStack 8, OpenStack Cloud 8venv-openstack-ironic9.1.8~dev8-12.33.3SUSE-SU-2021:2554-1
71 more for SUSE in the JSON and on SUSE's page.
openSUSETumbleweedpython-Django3.2.7-2.3openSUSE-SU-2024:11205-1
openSUSETumbleweedpython-Django4.2.11-2.1openSUSE-SU-2024:13887-1
openSUSETumbleweedpython-Django5.2.16-1.1openSUSE-SU-2026:11248-1
openSUSETumbleweedpython-Django44.2.14-1.1openSUSE-SU-2024:14208-1
openSUSETumbleweedpython-Django44.2.30-4.1openSUSE-SU-2026:11235-1
openSUSETumbleweedpython-Django55.2.16-1.1openSUSE-SU-2026:11270-1
openSUSETumbleweedpython-Django66.0-1.1openSUSE-SU-2026:10005-1

From the distributions' data via OSV.dev: the Debian Security Tracker; Ubuntu Security Notices © Canonical Ltd., CC BY-SA 4.0; Red Hat Security Data © Red Hat, Inc., CC BY 4.0; SUSE security data, CC BY 4.0. Modified: reformatted and linked to CVE records. Credits. On the distributions' own pages: Debian · Ubuntu · Red Hat · SUSE · openSUSE.

Red Hat

Red Hat rates this Moderate.

Red Hat's statement

Red Hat Update Infrastructure is in the maintenance phase and we will not be fixing Medium/Low impact security bugs. Reference: https://access.redhat.com/support/policy/updates/rhui

Red Hat's mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

ProductPackageStateAdvisory
Red Hat OpenStack Platform 16.1python-django20-0:2.0.13-16.el8ost.1Fixed 2021-12-09RHSA-2021:5070
Red Hat Satellite 6.10 for RHEL 7python3-django-0:2.2.24-1.el7pcFixed 2021-11-16RHSA-2021:4702
Red Hat Ansible Automation Platform 1.2djangoAffected
Red Hat Ansible Automation Platform 1.2python-djangoAffected
Red Hat Ansible Tower 3djangoNot affected
Red Hat Ceph Storage 2calamari-serverOut of support scope
Red Hat Ceph Storage 2python-djangoOut of support scope
Red Hat Ceph Storage 3python-djangoOut of support scope
Red Hat OpenStack Platform 10 (Newton)python-djangoOut of support scope
Red Hat OpenStack Platform 13 (Queens)python-djangoWill not fix
Red Hat Satellite 6python-djangoWill not fix
Red Hat Storage 3python-djangoWill not fix
Red Hat Update Infrastructure 3 for Cloud Providerspython-djangoWill not fix

Contains Red Hat Security Data © Red Hat, Inc., licensed under CC BY 4.0. Source: https://access.redhat.com/security/data. Modified: reformatted. Red Hat's page for CVE-2021-31542.

Attack patterns (CAPEC)

  • CAPEC-64 Using Slashes and URL Encoding Combined to Bypass Validation Logic Likelihood: High · Severity: High
  • CAPEC-76 Manipulating Web Input to File System Calls Likelihood: High · Severity: Very High
  • CAPEC-78 Using Escaped Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-79 Using Slashes in Alternate Encoding Likelihood: High · Severity: High
  • CAPEC-126 Path Traversal Likelihood: High · Severity: Very High

The attack patterns MITRE's CAPEC relates to this record's weaknesses, as MITRE names them. Credits.

References

Check your stackJSON