Skip to content
DoS Disclosed report Intermediate CVE-2023-24580

Potential DoS vulnerability in Django in multipart parser

The Django multipart request parser processed an unlimited number of file parts, opening a temporary file for each and keeping it open for the request duration. An attacker could send a request with many parts to exhaust file descriptors and memory, causing a denial of service.

das7pad Follow

Originally disclosed on HackerOne

Bounty$2,400 Medium View original
  • Triaged in 44 hours
  • Fixed in 4 days
  • Paid in 4 days
  • Disclosed after 6 days

Summary by the program

CVE-2023-24580: Potential denial-of-service vulnerability in file uploads Passing certain inputs to multipart forms could result in too many open files or memory exhaustion, and provided a potential vector for a denial-of-service attack.

The number of files parts parsed is now limited via the new DATA_UPLOAD_MAX_NUMBER_FILES setting.

Thanks to Jakob Ackermann for the report.

This issue has severity "moderate" according to the Django security policy.

Full Security Advisory: https://www.djangoproject.com/weblog/2023/feb/14/security-releases/

The report

In Django 3.2.x before 3.2.18, 4.0.x before 4.0.10 and 4.1.x before 4.1.7, the multipart request parser was subject to a Denial of Service attack. The multipart request parser processes the request body on endpoints with a form and any other POST endpoints as well. The parser was processing an unlimited number of empty/file multipart-parts. For each file part a new temporary file was opened and kept open for the entire duration of the request. The parsing and tracking of an unbound number of parts/files can lead to too many files being open and memory exhaustion.

Side note: The DoS vectors are not unique to the multipart request parser in Django. Many other large vendors (other programming languages/frameworks/applications) were notified about the DoS vectors as well and an embargo date was set for the coordinated disclosure.

The Django maintainers took part in a coordinated disclosure of the DoS vulnerability with many other large vendors. This required scheduling a dedicated release for the fixes in Django. The Django maintainers shared their patch with me well in advance for validation and refined it based on feedback.

Impact

Too many open files can stop other requests from opening files e.g. for rendering templates. High memory usage can lead to the application getting OOM killed. When the application gets OOM killed, all the open files are left behind, which in turn can lead to exhaustion of disk space/inodes.

The original report as published on HackerOne, by das7pad. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The multipart parser had no limit on the number of file parts it would process, and it opened a temporary file for each part without closing them until the request ended.

Impact

An attacker could cause too many open files and memory exhaustion, potentially leading to the application being OOM killed and leaving open files that exhaust disk space or inodes.

What the attacker needed

Ability to send HTTP requests to a Django endpoint

The fix

The number of file parts parsed is now limited via the new DATA_UPLOAD_MAX_NUMBER_FILES setting.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a web form uploads files, the server splits the request into parts and handles each file. Django did not limit how many parts it would accept, so a malicious request with thousands of parts could use up the server's file handles and memory. This could make the site slow or crash for other users.

What is DoS?

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.

More by das7pad

View all

1 more disclosed report, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Denial of service

The lesson behind this report.

A request that exhausts resources or crashes a component. Many programs forbid testing it; reports usually show it from code, not by attacking.