CVE-2022-34265
Django `Trunc()` and `Extract()` database functions vulnerable to SQL Injection
Also known as BIT-django-2022-34265, GHSA-p64x-8rxx-wf6q, PYSEC-2022-213
Mitigation
- Upgrade django to one of 3.2.14, 4.0.6 (or later in the same release line).
Who should check
- Projects that depend on PyPI package django (>= 3.2a1, < 3.2.14)
- Anyone running n/a (versions: see the vendor advisory)
Vulnerability facts
- Affected
- django >= 3.2a1, < 3.2.14
- Fixed in
- 3.2.14, 4.0.6
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.8 (v3.1, NVD)CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: None
- Scope: Unchanged
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 21.33% chance of exploitation in 30 days (percentile 98, 2026-11-26)
- CWE
- CWE-89
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI django | >= 3.2a1, < 3.2.14 | 3.2.14, 4.0.6 | osv |
| n/a | — | — | nvd |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2022-34265. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2022-34265.md Affected: django >= 3.2a1, < 3.2.14 Fixed in: 3.2.14, 4.0.6 Steps: 1. Search this machine and project for django (PyPI), n/a: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
- https://www.debian.org/security/2022/dsa-5254
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI/
- https://nvd.nist.gov/vuln/detail/CVE-2022-34265
- https://github.com/advisories/GHSA-p64x-8rxx-wf6q
Patches
- https://docs.djangoproject.com/en/4.0/releases/security/
- https://www.djangoproject.com/weblog/2022/jul/04/security-releases/
- https://github.com/django/django/commit/0dc9c016fadb71a067e5a42be30164e3f96c0492
- https://github.com/django/django/commit/5e2f4ddf2940704a26a4ac782b851989668d74db
- https://github.com/django/django/commit/877c800f255ccaa7abde1fb944de45d1616f5cc9
- https://github.com/django/django/commit/a9010fe5555e6086a9d9ae50069579400ef0685e
Other
- https://groups.google.com/forum/#%21forum/django-announce
- https://security.netapp.com/advisory/ntap-20220818-0006/
- https://docs.djangoproject.com/en/4.0/releases/security
- https://github.com/django/django
- https://github.com/pypa/advisory-database/tree/main/vulns/django/PYSEC-2022-213.yaml
- https://groups.google.com/forum/#!forum/django-announce
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HWY6DQWRVBALV73BPUVBXC3QIYUM24IK
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LTZVAKU5ALQWOKFTPISE257VCVIYGFQI
- https://security.netapp.com/advisory/ntap-20220818-0006
- https://www.djangoproject.com/weblog/2022/jul/04/security-releases
FAQ
Is CVE-2022-34265 being exploited?
There is no confirmed exploitation: CVE-2022-34265 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 21.33% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2022-34265?
Critical: CVSS 9.8 (v3.1, scored by NVD). Remote, no login needed.
Which versions are affected by CVE-2022-34265?
django >= 3.2a1, < 3.2.14.
Is there a fix for CVE-2022-34265?
Yes. Fixed in 3.2.14, 4.0.6. Upgrade django to one of 3.2.14, 4.0.6 (or later in the same release line).
How do I check if I'm affected by CVE-2022-34265?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.