The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2025-57833

CVE-2025-57833: Django FilteredRelation SQL Injection Flaw

CVE-2025-57833 is a SQL injection vulnerability in Django's FilteredRelation feature that allows attackers to inject malicious SQL through crafted dictionaries. This article covers technical details, affected versions, and mitigation.

Published: March 11, 2026

CVE-2025-57833 Overview

An SQL injection vulnerability was discovered in Django affecting versions 4.2 before 4.2.24, 5.1 before 5.1.12, and 5.2 before 5.2.6. The vulnerability exists in FilteredRelation's handling of column aliases, where a specially crafted dictionary passed via dictionary expansion as **kwargs to QuerySet.annotate() or QuerySet.alias() can enable SQL injection attacks. This flaw allows unauthenticated attackers to potentially execute arbitrary SQL commands against the underlying database.

Critical Impact

Unauthenticated attackers can exploit this SQL injection vulnerability to read, modify, or delete sensitive database contents, potentially leading to complete database compromise and remote code execution in certain configurations.

Affected Products

  • Django 4.2 before 4.2.24
  • Django 5.1 before 5.1.12
  • Django 5.2 before 5.2.6

Discovery Timeline

  • 2025-09-03 - Django Project releases security patch
  • 2025-09-03 - CVE CVE-2025-57833 published to NVD
  • 2025-11-04 - Last updated in NVD database

Technical Details for CVE-2025-57833

Vulnerability Analysis

This SQL injection vulnerability (CWE-89) exists in Django's FilteredRelation class, specifically in how it processes column aliases. The vulnerability is exploitable through the ORM's QuerySet.annotate() and QuerySet.alias() methods when they receive dictionary expansion from user-controlled input.

The flaw allows attackers to inject malicious SQL fragments through carefully constructed dictionary keys used as column aliases. When the application uses dictionary unpacking (**kwargs) to pass user-influenced data to these QuerySet methods, the column alias values are not properly sanitized before being incorporated into the generated SQL query.

While the vulnerability requires network access and the attack complexity is high due to the specific conditions needed for exploitation, successful attacks can compromise the confidentiality, integrity, and availability of the database system. The vulnerability is particularly dangerous in applications that dynamically construct annotations or aliases based on user input without proper validation.

Root Cause

The root cause of this vulnerability is insufficient input validation and sanitization of dictionary keys when they are used as column aliases in FilteredRelation. Django's ORM typically handles SQL injection protection for query values, but the column alias mechanism did not apply the same level of scrutiny to dictionary keys passed via **kwargs expansion.

When developers use patterns like queryset.annotate(**user_provided_dict) or queryset.alias(**user_provided_dict), the dictionary keys become column aliases in the SQL query. Without proper sanitization, malicious SQL fragments embedded in these keys can break out of the intended context and execute arbitrary SQL commands.

Attack Vector

The attack requires network access to an application endpoint that processes user input and passes it through dictionary expansion to Django's QuerySet.annotate() or QuerySet.alias() methods. The attacker must craft a malicious dictionary where the keys contain SQL injection payloads designed to escape the column alias context.

A successful exploit could allow attackers to:

  1. Extract sensitive data from the database through UNION-based or boolean-based injection
  2. Modify or delete database records
  3. Execute database administrative commands
  4. In certain database configurations with extended permissions, achieve remote code execution through database features like xp_cmdshell (SQL Server) or COPY TO PROGRAM (PostgreSQL)

The vulnerability mechanism involves the attacker providing input that gets processed into a dictionary structure, which is then unpacked and passed to the vulnerable QuerySet methods. The malicious column alias escapes its context in the generated SQL, allowing arbitrary SQL execution. For detailed technical analysis, see the Medium Exploit Analysis and Openwall OSS Security Post.

Detection Methods for CVE-2025-57833

Indicators of Compromise

  • Unusual or malformed SQL queries in database logs containing suspicious column alias patterns
  • Database error logs showing syntax errors related to annotation or alias operations
  • Unexpected data access patterns or unauthorized database queries
  • Web application logs showing requests with dictionary-like payloads targeting API endpoints

Detection Strategies

  • Implement Web Application Firewall (WAF) rules to detect SQL injection patterns in request parameters
  • Enable and monitor Django's SQL query logging for anomalous annotation and alias patterns
  • Deploy database activity monitoring to detect unusual query structures targeting FilteredRelation operations
  • Use application security monitoring to identify requests containing nested dictionary structures with special characters

Monitoring Recommendations

  • Monitor Django application logs for errors related to QuerySet.annotate() and QuerySet.alias() operations
  • Enable database audit logging to capture all SQL statements and identify injection attempts
  • Set up alerts for database errors that may indicate SQL injection exploitation attempts
  • Review application endpoints that accept dictionary-like input structures for potential exposure

How to Mitigate CVE-2025-57833

Immediate Actions Required

  • Upgrade Django to patched versions: 4.2.24, 5.1.12, or 5.2.6 immediately
  • Audit application code for usage of QuerySet.annotate() or QuerySet.alias() with user-controlled input
  • Implement strict input validation for any data that may be passed to Django ORM methods
  • Review and restrict database user permissions to minimize potential impact of exploitation

Patch Information

Django has released security patches addressing this vulnerability. Organizations should upgrade to the following patched versions:

  • Django 4.2.24 for the 4.2.x series
  • Django 5.1.12 for the 5.1.x series
  • Django 5.2.6 for the 5.2.x series

Refer to the Django Security Release Notes and the Django Weblog Security Releases for complete patch details. Subscribe to the Django Announce Group for future security notifications.

Workarounds

  • Validate and sanitize all dictionary keys before passing them to QuerySet.annotate() or QuerySet.alias()
  • Use an allowlist approach for column alias names, rejecting any input containing special characters
  • Avoid using dictionary unpacking (**kwargs) with user-controlled data in ORM operations
  • Implement application-level input validation that restricts dictionary keys to alphanumeric characters and underscores only
bash
# Upgrade Django to patched version
pip install --upgrade django>=4.2.24  # For 4.2.x users
pip install --upgrade django>=5.1.12  # For 5.1.x users
pip install --upgrade django>=5.2.6   # For 5.2.x users

# Verify installed version
python -c "import django; print(django.VERSION)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeSQLI

  • Vendor/TechDjangoproject Django

  • SeverityHIGH

  • CVSS Score8.1

  • EPSS Probability0.02%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-89
  • Technical References
  • Medium Exploit Analysis

  • Openwall OSS Security Post

  • Debian LTS Security Announcement
  • Vendor Resources
  • Django Security Release Notes

  • Django Announce Group

  • Django Weblog Security Releases
  • Related CVEs
  • CVE-2026-1312: Djangoproject Django SQLi Vulnerability

  • CVE-2026-1207: Django SQLi Vulnerability in RasterField

  • CVE-2025-59681: Django SQL Injection Vulnerability

  • CVE-2024-42005: Django JSONField SQL Injection Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English