Skip to content
File upload Write-up Intermediate

CVE-2023–31047 | Django — Improper Input Validation Vuln

Django's file and image form fields did not support multiple file uploads, so when several files were submitted only the last one was validated. An attacker could upload a malicious file alongside a valid image, and the unchecked file would reach the server.

Yunus Olçar Follow

Published on medium.com

Hey, welcome! In this post, we’ll take a closer look at a “low” severity vulnerability in Django.

Yunus Olçar, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

The form field's value extraction used a single-file lookup, so only one submitted file was passed to validation while the others bypassed it.

Impact

An attacker could upload a malicious file that bypassed validation, which could lead to more severe security breaches.

What the attacker needed

A form field that accepts file uploads; ability to submit multiple files in one request

The fix

The field gained an explicit multiple-upload flag, rejects inconsistent configuration, and now retrieves all submitted files for validation when multiple uploads are allowed.

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 write-up has not been written yet. The Original tab links to the source.

A web form can accept files, and the server is supposed to check each one before saving it. In this bug, if someone sent several files at once, Django only checked the last one and let the rest through without inspection. That means a harmful file could be stored on the server even though the form was meant to allow only safe images.

What is File upload?

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.

More by Yunus Olçar

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Unrestricted file upload

The lesson behind this report.

An upload feature accepts a file that the server or other users' browsers then treat as code or as something trusted.