CVE-2022-34265: Django - SQL injection
- Template: CVE-2022-34265
- Name: Django - SQL injection
- Description: 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.
- Impact: Attackers can execute arbitrary SQL commands, potentially leading to data theft, modification, or deletion.
- Remediation: Upgrade Django to version 3.2.14 or 4.0.6 or later that properly sanitizes kind/lookup_name values in Trunc() and Extract() database functions.
- Severity: critical
- Authors: princechaddha
- Tags: sqli, dast, vulhub, cve, cve2022, django, vuln
- References: https://github.com/vulhub/vulhub/tree/master/django/CVE-2022-34265, https://nvd.nist.gov/vuln/detail/CVE-2022-34265, https://www.djangoproject.com/weblog/2022/jul/04/security-releases/, https://docs.djangoproject.com/en/4.0/releases/security/
- Cves: CVE-2022-34265
- Directory: dast/cves
- Path: dast/cves/2022/CVE-2022-34265.yaml
- Digest: 4b0a00483046022100f377dd39d7569c82c25c3ca95ec68eb0989d6e1faaa7b63898535c7895bb3250022100e33cd130456d2838e6409eca064917dea07ef53aa6b9c038511dc78d58003f1a
- Created at: 2024-04-08T07:04:36Z
- Updated at: 2026-11-24T02:03:42Z
- Age in days: 960
- Template url: https://github.com/projectdiscovery/nuclei-templates/blob/main/dast/cves/2022/CVE-2022-34265.yaml
- Checked, none or zero: verified, products
- Not known: max requests
Classification
- Cwe: CWE-89
- Cvss score: 9.8
- Cvss vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- Epss score: 0.73607
- Epss percentile: 0.99479
- Not known: cpe
Metadata
Labels
- Name: Django - SQL Injection
- Impact: Attackers can execute arbitrary SQL commands, potentially leading to data theft, modification, or deletion.
- Remediation: Update to Django 3.2.14 or later, or 4.0.6 or later.
- Vulnerability type: sql_injection
- Vulnerability impact: information_disclosure, data_tampering
- Requirement type: none
- Labels source: projectdiscovery
- From cve: CVE-2022-34265
- Not known: requirements
```yaml
id: CVE-2022-34265
info:
name: Django - SQL injection
author: princechaddha
severity: critical
description: |
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.
remediation: |
Upgrade Django to version 3.2.14 or 4.0.6 or later that properly sanitizes kind/lookup_name values in Trunc() and Extract() database functions.
impact: |
Attackers can execute arbitrary SQL commands, potentially leading to data theft, modification, or deletion.
reference:
- https://github.com/vulhub/vulhub/tree/master/django/CVE-2022-34265
- https://nvd.nist.gov/vuln/detail/CVE-2022-34265
- https://www.djangoproject.com/weblog/2022/jul/04/security-releases/
- https://docs.djangoproject.com/en/4.0/releases/security/
classification:
cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
cvss-score: 9.8
cve-id: CVE-2022-34265
cwe-id: CWE-89
epss-score: 0.73607
epss-percentile: 0.99479
tags: sqli,dast,vulhub,cve,cve2022,django,vuln
variables:
rand_string: '{{rand_text_alpha(15, "abc")}}'
http:
- pre-condition:
- type: dsl
dsl:
- 'method == "GET"'
fuzzing:
- part: query
fuzz:
- "test'{{rand_string}}"
matchers-condition: and
matchers:
- type: word
part: body
words:
- 'syntax error at or near "{{rand_string}}"'
- 'LINE 1: SELECT DATE_TRUNC'
condition: and
- type: status
status:
- 500
digest: 4b0a00483046022100f377dd39d7569c82c25c3ca95ec68eb0989d6e1faaa7b63898535c7895bb3250022100e33cd130456d2838e6409eca064917dea07ef53aa6b9c038511dc78d58003f1a:922c64590222798bb761d5b6d8e72950
```