CVE-2024-53908: Django SQL Injection Vulnerability in JSON Field Lookup

django Updated 02 Oct 2025

Summary

10/03/2025
Yes i
Critical
Not published

CVE-2024-53908: An issue was discovered in Django 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17. Affects django across 2 version ranges.

>= 4.2.0, < 4.2.17 >= 5.0.0, < 5.1.4

Fixed in 4.2.17 or 5.1.4, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2024-53908 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. It provides a robust set of features for building web applications, including an ORM (Object-Relational Mapping) system, which allows developers to interact with databases using Python code instead of SQL. However, certain versions of Django are vulnerable to SQL injection attacks when using the jsonfield.has_key lookup with untrusted data, particularly when connected to an Oracle database.

Vulnerability Detail

An issue was discovered in Django versions 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17. The vulnerability arises from the direct usage of the django.db.models.fields.json.HasKey lookup, which can be exploited if untrusted data is used as a left-hand side (lhs) value. This can lead to SQL injection attacks, allowing attackers to manipulate database queries and potentially gain unauthorized access to sensitive data.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 4.2.0, < 4.2.17 4.2.17
  • >= 5.0.0, < 5.1.4 5.1.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

If you cannot update Django immediately, avoid using the jsonfield.has_key lookup with untrusted data as the lhs value. Instead, consider using alternative methods to achieve similar functionality without exposing your application to SQL injection risks.

Conclusion

In summary, CVE-2024-53908 is a critical SQL injection vulnerability affecting specific versions of Django when using the jsonfield.has_key lookup with untrusted data. It is essential to update to the patched versions to secure your application and prevent potential exploitation.

See every vulnerability recorded for django →

Share this vulnerability

FAQ

CVE-2024-53908 is a vulnerability in Django that allows SQL injection through the jsonfield.has_key lookup when untrusted data is used.

Django versions 5.1 before 5.1.4, 5.0 before 5.0.10, and 4.2 before 4.2.17 are affected by this vulnerability.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.

If an immediate update is not possible, avoid using the jsonfield.has_key lookup with untrusted data to mitigate the risk of SQL injection.

Exploitation of this vulnerability can lead to unauthorized access to sensitive data and manipulation of database queries, posing significant security risks.

Related vulnerabilities

Recent vulnerabilities recorded for django.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • >= 4.2.0, < 4.2.17 4.2.17
  • >= 5.0.0, < 5.1.4 5.1.4

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback