CVE-2022-34265 — Vulnerability in django — CVE Details
Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection
What Should I Do?
Low-to-Moderate Risk
Exploitation probability is 21.33% in 30 days. Address in your next planned sprint.
Does your project use an affected django version?
Paste your requirements.txt to check it for CVE-2022-34265 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
An issue was discovered in Django 3.2 before 3.2.14 and 4.0 before 4.0.6. The Trunc() and Extract() database functions are subject to SQL injection if untrusted data is used as a kind/lookup_name value. Applications that constrain the lookup name and kind choice to a known safe list are unaffected.
Advisory Timeline
- First published July 5, 2022 (1605 days ago).
- Last revised February 21, 2025 — 962 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
pip install "django>=4.0.6"
pip install "django>=3.2.14"
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (2)
Affects 1 ecosystem: PyPI (1).
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-89SQL InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
References
- https://nvd.nist.gov/vuln/detail/CVE-2022-34265ADVISORY
- https://github.com/django/django/commit/0dc9c016fadb71a067e5a42be30164e3f96c0492WEB
- https://github.com/django/django/commit/5e2f4ddf2940704a26a4ac782b851989668d74dbWEB
- https://github.com/django/django/commit/877c800f255ccaa7abde1fb944de45d1616f5cc9WEB
- https://github.com/django/django/commit/a9010fe5555e6086a9d9ae50069579400ef0685eWEB
- https://docs.djangoproject.com/en/4.0/releases/securityWEB
- https://github.com/advisories/GHSA-p64x-8rxx-wf6qADVISORY
- https://github.com/django/djangoPACKAGE
- https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-213.yamlWEB
- https://groups.google.com/forum/#!forum/django-announceWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IKWEB
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQIWEB
- https://security.netapp.com/advisory/ntap-20220818-0006WEB
- https://www.debian.org/security/2022/dsa-5254WEB
- https://www.djangoproject.com/weblog/2022/jul/04/security-releasesWEB
Frequently Asked Questions
- What is CVE-2022-34265?
- Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection. This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
- How do I check if my project is affected by CVE-2022-34265?
- CVE-2022-34265 affects django. It has a 21.3% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2022-34265 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Maximum impact if exploited, often with little effort or access required.
This places it in the top 5% of EPSS-scored vulnerabilities — 98.1% of tracked vulnerabilities score at or below it, so it is far more likely to be exploited than nearly all other tracked vulnerabilities.
Also Known As
Related CVEs
- CVE-2026-1285HIGH
- CVE-2026-1287MEDIUM
- CVE-2023-41164MEDIUM
Django Denial of service vulnerability in django.utils.encoding.uri_to_iri
- CVE-2025-48432MEDIUM
Django Improper Output Neutralization for Logs vulnerability
- CVE-2025-26699MEDIUM
Django Vulnerable to Allocation of Resources Without Limits or Throttling
- CVE-2021-28658
- CVE-2024-41989
- CVE-2021-44420