CVE-2023-31047

In Django 3.2 before 3.2.19, 4.x before 4.1.9, and 4.2 before 4.2.1, it was possible to bypass validation when using one form field to upload multiple files

Critical · published May 7, 2023

CVSS v3.1
9.8
EPSS
1%
Percentile
72.1
In the wild
Unconfirmed
What it is

🚨 A sneaky file upload flaw in Django lets the last file uploaded slip past validation, leaving your app wide open! 🔥 Think of this as a pizza order where only the last topping is checked for quality, while the first few could be spoiled. Just like a kitchen that assumes all ingredients are good because the last one looks delicious, your app could end up serving bad files if not properly validated! An attacker could exploit this vulnerability to upload malicious files without any validation, potentially compromising your server and exposing sensitive data. This could lead to unauthorized access, data leaks, or even executing harmful scripts—an absolute nightmare for any application!

Put simply

Think of this as a pizza order where only the last topping is checked for quality, while the first few could be spoiled. Just like a kitchen that assumes all ingredients are good because the last one looks delicious, your app could end up serving bad files if not properly validated! This vulnerability allows multiple file uploads to bypass validation checks, as only the last uploaded file is validated. Django's forms.FileField and forms.ImageField were not designed to handle multiple file uploads correctly, leading to this critical flaw.

What to do

An attacker could exploit this vulnerability to upload malicious files without any validation, potentially compromising your server and exposing sensitive data. This could lead to unauthorized access, data leaks, or even executing harmful scripts—an absolute nightmare for any application! To protect your application, immediately update Django to versions 3.2.19, 4.1.9, or 4.2.1. Review your file upload logic to ensure proper validation for all files and consider enforcing stricter checks for uploaded content. 🛡️ You’ve got this! Follow these steps, and your application will be fighting fit in no time! 💪😊

The record
Technical detail
CVSS v3.1
9.8 · CRITICAL
Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.01391 · 72.1th percentile
Published
2023-05-07T00:00Z
EPSS history
Timeline
  • 07 MAY 00:00Z
    In Django 3.2 before 3.2.19, 4.x before 4.1.9, and 4.2 before 4.2.1, it was possible to bypass validation when using one form field to upload multiple files
    cvelistv5