CVE-2022-23833
Description
An issue was discovered in MultiPartParser in Django 2.2 before 2.2.27, 3.2 before 3.2.12, and 4.0 before 4.0.2. Passing certain inputs to multipart forms could result in an infinite loop when parsing files.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Django multipart form parser infinite loop DoS via crafted input in versions before 2.2.27, 3.2.12, 4.0.2.
Vulnerability
CVE-2022-23833 is a denial-of-service vulnerability in Django's MultiPartParser component used for parsing multipart form data, specifically in the parse() method. The issue arises when processing file uploads: a loop in the parser that reads chunks of data can become infinite if the input contains certain malformed chunk boundaries, causing the server to hang [1][2]. Affected versions include Django 2.2 before 2.2.27, 3.2 before 3.2.12, and 4.0 before 4.0.2 [1].
Exploitation
An attacker can exploit this vulnerability by sending a specially crafted multipart HTTP POST request to a Django application that processes file uploads. No authentication is required if the upload endpoint is publicly accessible. The attacker crafts the request such that the parser enters an infinite loop while reading chunked data, leading to resource exhaustion [2].
Impact
Successful exploitation results in a denial-of-service condition where the server becomes unresponsive due to the infinite loop, consuming CPU and potentially blocking other requests. This can lead to service disruption for legitimate users [1][2].
Mitigation
The vulnerability is fixed in Django versions 2.2.27, 3.2.12, and 4.0.2, released on February 3, 2022 [1][3][4]. Users should upgrade to these or later versions immediately. As a temporary workaround, disabling file upload functionality may reduce exposure, but upgrading is recommended.
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
DjangoPyPI | >= 2.2, < 2.2.27 | 2.2.27 |
DjangoPyPI | >= 3.2, < 3.2.12 | 3.2.12 |
DjangoPyPI | >= 4.0, < 4.0.2 | 4.0.2 |
Affected products
74- Django/Djangodescription
- osv-coords73 versionspkg:bitnami/djangopkg:pypi/djangopkg:rpm/opensuse/python-Django4&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/python-Django6&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/python-Django&distro=openSUSE%20Leap%2015.3pkg:rpm/opensuse/python-Django&distro=openSUSE%20Tumbleweedpkg:rpm/suse/python-Django1&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/python-Django1&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209pkg:rpm/suse/python-Django&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/python-Django&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/python-Django&distro=SUSE%20OpenStack%20Cloud%20Crowbar%208pkg:rpm/suse/python-Django&distro=SUSE%20Package%20Hub%2015%20SP3pkg:rpm/suse/venv-openstack-aodh&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-aodh&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-barbican&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-barbican&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-barbican&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-ceilometer&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-ceilometer&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-cinder&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-cinder&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-cinder&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-designate&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-designate&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-designate&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-freezer&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-freezer&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-glance&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-glance&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-glance&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-heat&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-heat&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-heat&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-horizon&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-horizon&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-horizon-hpe&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-ironic&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-ironic&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-ironic&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-keystone&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-keystone&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-keystone&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-magnum&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-magnum&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-magnum&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-manila&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-manila&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-manila&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-monasca-ceilometer&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-monasca-ceilometer&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-monasca-ceilometer&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-monasca&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-monasca&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-monasca&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-murano&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-murano&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-neutron&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-neutron&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-neutron&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-nova&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-nova&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-nova&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-octavia&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-octavia&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-octavia&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-sahara&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-sahara&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-sahara&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-swift&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-swift&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/venv-openstack-swift&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/venv-openstack-trove&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/venv-openstack-trove&distro=SUSE%20OpenStack%20Cloud%208
>= 2.2.0, < 2.2.27+ 72 more
- (no CPE)range: >= 2.2.0, < 2.2.27
- (no CPE)range: >= 2.2, < 2.2.27
- (no CPE)range: < 4.2.14-1.1
- (no CPE)range: < 6.0-1.1
- (no CPE)range: < 2.2.28-bp153.2.3.1
- (no CPE)range: < 4.0.2-1.1
- (no CPE)range: < 1.11.29-3.37.1
- (no CPE)range: < 1.11.29-3.37.1
- (no CPE)range: < 1.11.29-3.39.1
- (no CPE)range: < 1.11.29-3.39.1
- (no CPE)range: < 1.11.29-3.39.1
- (no CPE)range: < 2.2.28-bp153.2.3.1
- (no CPE)range: < 5.1.1~dev7-12.37.1
- (no CPE)range: < 5.1.1~dev7-12.37.1
- (no CPE)range: < 5.0.2~dev3-12.38.1
- (no CPE)range: < 5.0.2~dev3-12.38.1
- (no CPE)range: < 7.0.1~dev24-3.30.1
- (no CPE)range: < 9.0.8~dev7-12.35.1
- (no CPE)range: < 9.0.8~dev7-12.35.1
- (no CPE)range: < 11.2.3~dev29-14.39.1
- (no CPE)range: < 11.2.3~dev29-14.39.1
- (no CPE)range: < 13.0.10~dev23-3.33.1
- (no CPE)range: < 5.0.3~dev7-12.36.1
- (no CPE)range: < 5.0.3~dev7-12.36.1
- (no CPE)range: < 7.0.2~dev2-3.30.1
- (no CPE)range: < 5.0.0.0~xrc2~dev2-10.33.1
- (no CPE)range: < 5.0.0.0~xrc2~dev2-10.33.1
- (no CPE)range: < 15.0.3~dev3-12.36.1
- (no CPE)range: < 15.0.3~dev3-12.36.1
- (no CPE)range: < 17.0.1~dev30-3.28.1
- (no CPE)range: < 9.0.8~dev22-12.40.1
- (no CPE)range: < 9.0.8~dev22-12.40.1
- (no CPE)range: < 11.0.4~dev4-3.30.1
- (no CPE)range: < 12.0.5~dev6-14.43.2
- (no CPE)range: < 14.1.1~dev11-4.34.2
- (no CPE)range: < 12.0.5~dev6-14.43.2
- (no CPE)range: < 9.1.8~dev8-12.38.1
- (no CPE)range: < 9.1.8~dev8-12.38.1
- (no CPE)range: < 11.1.5~dev17-4.28.1
- (no CPE)range: < 12.0.4~dev11-11.40.1
- (no CPE)range: < 12.0.4~dev11-11.40.1
- (no CPE)range: < 14.2.1~dev7-3.31.1
- (no CPE)range: < 5.0.2_5.0.2_5.0.2~dev31-11.37.1
- (no CPE)range: < 5.0.2_5.0.2_5.0.2~dev31-11.37.1
- (no CPE)range: < 7.2.1~dev1-4.30.1
- (no CPE)range: < 5.1.1~dev5-12.42.1
- (no CPE)range: < 5.1.1~dev5-12.42.1
- (no CPE)range: < 7.4.2~dev60-3.36.1
- (no CPE)range: < 1.5.1_1.5.1_1.5.1~dev3-8.33.1
- (no CPE)range: < 1.5.1_1.5.1_1.5.1~dev3-8.33.1
- (no CPE)range: < 1.8.2~dev3-3.30.1
- (no CPE)range: < 2.2.2~dev1-11.40.1
- (no CPE)range: < 2.2.2~dev1-11.40.1
- (no CPE)range: < 2.7.1~dev10-3.32.1
- (no CPE)range: < 4.0.2~dev2-12.33.1
- (no CPE)range: < 4.0.2~dev2-12.33.1
- (no CPE)range: < 11.0.9~dev69-13.43.1
- (no CPE)range: < 11.0.9~dev69-13.43.1
- (no CPE)range: < 13.0.8~dev164-6.34.1
- (no CPE)range: < 16.1.9~dev92-11.41.1
- (no CPE)range: < 16.1.9~dev92-11.41.1
- (no CPE)range: < 18.3.1~dev91-3.34.1
- (no CPE)range: < 1.0.6~dev3-12.38.1
- (no CPE)range: < 1.0.6~dev3-12.38.1
- (no CPE)range: < 3.2.3~dev7-4.30.1
- (no CPE)range: < 7.0.5~dev4-11.37.1
- (no CPE)range: < 7.0.5~dev4-11.37.1
- (no CPE)range: < 9.0.2~dev15-3.30.1
- (no CPE)range: < 2.15.2_2.15.2_2.15.2~dev32-11.28.1
- (no CPE)range: < 2.15.2_2.15.2_2.15.2~dev32-11.28.1
- (no CPE)range: < 2.19.2~dev48-2.25.1
- (no CPE)range: < 8.0.2~dev2-11.37.1
- (no CPE)range: < 8.0.2~dev2-11.37.1
Patches
3c477b7618049[2.2.x] Fixed CVE-2022-23833 -- Fixed DoS possiblity in file uploads.
3 files changed · +28 −0
django/http/multipartparser.py+2 −0 modified@@ -240,6 +240,8 @@ def parse(self): remaining = len(stripped_chunk) % 4 while remaining != 0: over_chunk = field_stream.read(4 - remaining) + if not over_chunk: + break stripped_chunk += b"".join(over_chunk.split()) remaining = len(stripped_chunk) % 4
docs/releases/2.2.27.txt+6 −0 modified@@ -15,3 +15,9 @@ posing an XSS attack vector. In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. + +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files.
tests/file_uploads/tests.py+20 −0 modified@@ -142,6 +142,26 @@ def test_big_base64_upload(self): def test_big_base64_newlines_upload(self): self._test_base64_upload("Big data" * 68000, encode=base64.encodebytes) + def test_base64_invalid_upload(self): + payload = client.FakePayload('\r\n'.join([ + '--' + client.BOUNDARY, + 'Content-Disposition: form-data; name="file"; filename="test.txt"', + 'Content-Type: application/octet-stream', + 'Content-Transfer-Encoding: base64', + '' + ])) + payload.write(b'\r\n!\r\n') + payload.write('--' + client.BOUNDARY + '--\r\n') + r = { + 'CONTENT_LENGTH': len(payload), + 'CONTENT_TYPE': client.MULTIPART_CONTENT, + 'PATH_INFO': '/echo_content/', + 'REQUEST_METHOD': 'POST', + 'wsgi.input': payload, + } + response = self.client.request(**r) + self.assertEqual(response.json()['file'], '') + def test_unicode_file_name(self): with sys_tempfile.TemporaryDirectory() as temp_dir: # This file contains Chinese symbols and an accented char in the name.
f9c7d48fdd6f[4.0.x] Fixed CVE-2022-23833 -- Fixed DoS possiblity in file uploads.
5 files changed · +40 −0
django/http/multipartparser.py+2 −0 modified@@ -248,6 +248,8 @@ def parse(self): remaining = len(stripped_chunk) % 4 while remaining != 0: over_chunk = field_stream.read(4 - remaining) + if not over_chunk: + break stripped_chunk += b"".join(over_chunk.split()) remaining = len(stripped_chunk) % 4
docs/releases/2.2.27.txt+6 −0 modified@@ -15,3 +15,9 @@ posing an XSS attack vector. In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. + +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files.
docs/releases/3.2.12.txt+6 −0 modified@@ -15,3 +15,9 @@ posing an XSS attack vector. In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. + +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files.
docs/releases/4.0.2.txt+6 −0 modified@@ -18,6 +18,12 @@ In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files. + Bugfixes ========
tests/file_uploads/tests.py+20 −0 modified@@ -139,6 +139,26 @@ def test_big_base64_upload(self): def test_big_base64_newlines_upload(self): self._test_base64_upload("Big data" * 68000, encode=base64.encodebytes) + def test_base64_invalid_upload(self): + payload = client.FakePayload('\r\n'.join([ + '--' + client.BOUNDARY, + 'Content-Disposition: form-data; name="file"; filename="test.txt"', + 'Content-Type: application/octet-stream', + 'Content-Transfer-Encoding: base64', + '' + ])) + payload.write(b'\r\n!\r\n') + payload.write('--' + client.BOUNDARY + '--\r\n') + r = { + 'CONTENT_LENGTH': len(payload), + 'CONTENT_TYPE': client.MULTIPART_CONTENT, + 'PATH_INFO': '/echo_content/', + 'REQUEST_METHOD': 'POST', + 'wsgi.input': payload, + } + response = self.client.request(**r) + self.assertEqual(response.json()['file'], '') + def test_unicode_file_name(self): with sys_tempfile.TemporaryDirectory() as temp_dir: # This file contains Chinese symbols and an accented char in the name.
d16133568ef9[3.2.x] Fixed CVE-2022-23833 -- Fixed DoS possiblity in file uploads.
4 files changed · +34 −0
django/http/multipartparser.py+2 −0 modified@@ -248,6 +248,8 @@ def parse(self): remaining = len(stripped_chunk) % 4 while remaining != 0: over_chunk = field_stream.read(4 - remaining) + if not over_chunk: + break stripped_chunk += b"".join(over_chunk.split()) remaining = len(stripped_chunk) % 4
docs/releases/2.2.27.txt+6 −0 modified@@ -15,3 +15,9 @@ posing an XSS attack vector. In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. + +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files.
docs/releases/3.2.12.txt+6 −0 modified@@ -15,3 +15,9 @@ posing an XSS attack vector. In order to avoid this vulnerability, ``{% debug %}`` no longer outputs an information when the ``DEBUG`` setting is ``False``, and it ensures all context variables are correctly escaped when the ``DEBUG`` setting is ``True``. + +CVE-2022-23833: Denial-of-service possibility in file uploads +============================================================= + +Passing certain inputs to multipart forms could result in an infinite loop when +parsing files.
tests/file_uploads/tests.py+20 −0 modified@@ -143,6 +143,26 @@ def test_big_base64_upload(self): def test_big_base64_newlines_upload(self): self._test_base64_upload("Big data" * 68000, encode=base64.encodebytes) + def test_base64_invalid_upload(self): + payload = client.FakePayload('\r\n'.join([ + '--' + client.BOUNDARY, + 'Content-Disposition: form-data; name="file"; filename="test.txt"', + 'Content-Type: application/octet-stream', + 'Content-Transfer-Encoding: base64', + '' + ])) + payload.write(b'\r\n!\r\n') + payload.write('--' + client.BOUNDARY + '--\r\n') + r = { + 'CONTENT_LENGTH': len(payload), + 'CONTENT_TYPE': client.MULTIPART_CONTENT, + 'PATH_INFO': '/echo_content/', + 'REQUEST_METHOD': 'POST', + 'wsgi.input': payload, + } + response = self.client.request(**r) + self.assertEqual(response.json()['file'], '') + def test_unicode_file_name(self): with sys_tempfile.TemporaryDirectory() as temp_dir: # This file contains Chinese symbols and an accented char in the name.
Vulnerability mechanics
Generated on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
17- github.com/advisories/GHSA-6cw3-g6wv-c2xvghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/B4SQG2EAF4WCI2SLRL6XRDJ3RPK3ZRDV/mitrevendor-advisory
- nvd.nist.gov/vuln/detail/CVE-2022-23833ghsaADVISORY
- www.debian.org/security/2022/dsa-5254ghsavendor-advisoryWEB
- docs.djangoproject.com/en/4.0/releases/securityghsaWEB
- github.com/django/django/commit/c477b761804984c932704554ad35f78a2e230c6aghsaWEB
- github.com/django/django/commit/d16133568ef9c9b42cb7a08bdf9ff3feec2e5468ghsaWEB
- github.com/django/django/commit/f9c7d48fdd6f198a6494a9202f90242f176e4fc9ghsaWEB
- github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-20.yamlghsaWEB
- groups.google.com/forum/ghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/B4SQG2EAF4WCI2SLRL6XRDJ3RPK3ZRDVghsaWEB
- security.netapp.com/advisory/ntap-20220221-0003ghsaWEB
- www.djangoproject.com/weblog/2022/feb/01/security-releasesghsaWEB
- docs.djangoproject.com/en/4.0/releases/security/mitre
- groups.google.com/forum/mitre
- security.netapp.com/advisory/ntap-20220221-0003/mitre
- www.djangoproject.com/weblog/2022/feb/01/security-releases/mitre
News mentions
0No linked articles in our index yet.