# CVE-2022-34265: Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection

- Severity: Critical 9.8 (CVSS:3.1, scored by NVD) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 73.6%, higher than 99% of CVEs (2026-12-01)
- Published: 2022-07-04T00:00:00.000Z
- Modified: 2026-09-08T08:46:36.455Z
- Also known as: GHSA-p64x-8rxx-wf6q, BIT-DJANGO-2022-34265, PYSEC-2022-213
- Weaknesses: CWE-89
- Assigned by: mitre

## 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.

(As written by CVE List.)

## Affected

- Unspecified product: n/a
- django (PyPI): from 3.2a1 before 3.2.14; from 4.0a1 before 4.0.6; from 3.2 before 3.2.14; from 4.0 before 4.0.6
- djangoproject django: from 3.2 before 3.2.14; from 4.0 before 4.0.6
- django (Bitnami): from 3.2.0 before 3.2.14; from 4.0.0 before 4.0.6

## Every score

- GitHub: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- GitHub: CVSS:4.0 Critical `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:2.0 7.5 High `AV:N/AC:L/Au:N/C:P/I:P/A:P`
- Bitnami Vulnerability Database: rating Critical

## References

- <https://groups.google.com/forum/#%21forum/django-announce> (web)
- <https://docs.djangoproject.com/en/4.0/releases/security/> (advisory, patch, vendor-advisory, web)
- <https://www.djangoproject.com/weblog/2022/jul/04/security-releases/> (advisory, article, patch, vendor-advisory)
- <https://security.netapp.com/advisory/ntap-20220818-0006/> (advisory, third-party-advisory)
- <https://www.debian.org/security/2022/dsa-5254> (advisory, third-party-advisory, vendor-advisory, web)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK/> (vendor-advisory, web)
- <https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI/> (vendor-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2022-34265> (advisory, web)
- <https://github.com/django/django/commit/0dc9c016fadb71a067e5a42be30164e3f96c0492> (web)
- <https://github.com/django/django/commit/5e2f4ddf2940704a26a4ac782b851989668d74db> (web)
- <https://github.com/django/django/commit/877c800f255ccaa7abde1fb944de45d1616f5cc9> (web)
- <https://github.com/django/django/commit/a9010fe5555e6086a9d9ae50069579400ef0685e> (web)
- <https://docs.djangoproject.com/en/4.0/releases/security> (web)
- <https://github.com/advisories/GHSA-p64x-8rxx-wf6q> (advisory)
- <https://github.com/django/django> (package)
- <https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-213.yaml> (web)
- <https://groups.google.com/forum/#!forum/django-announce> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK> (web)
- <https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI> (web)
- <https://security.netapp.com/advisory/ntap-20220818-0006> (web)
- <https://www.djangoproject.com/weblog/2022/jul/04/security-releases> (web)

## Sources

- CVE List: [CVE-2022-34265](https://www.cve.org/CVERecord?id=CVE-2022-34265), CVE Terms of Use, modified 2025-02-13
- GitHub Advisory Database: [GHSA-p64x-8rxx-wf6q](https://github.com/advisories/GHSA-p64x-8rxx-wf6q), CC-BY-4.0, modified 2025-02-21
- NVD: [CVE-2022-34265](https://nvd.nist.gov/vuln/detail/CVE-2022-34265), Public domain, modified 2026-06-17
- PyPA Advisory Database: [PYSEC-2022-213](https://osv.dev/vulnerability/PYSEC-2022-213), CC-BY-4.0, modified 2023-12-06
- Bitnami Vulnerability Database: [BIT-DJANGO-2022-34265](https://osv.dev/vulnerability/BIT-DJANGO-2022-34265), Apache-2.0, modified 2026-09-08

---

Page: https://cve.day/CVE-2022-34265 · Whole record: https://cve.day/CVE-2022-34265.json · Rebuilt by cve.day 2026-11-25T22:58:12.703Z
