Skip to content
OpenAdvisories
Critical · 9.8 Public exploit CVE-2022-28346 BIT-django-2022-28346EUVD-2022-0087GHSA-2gwj-7jmv-h26rPYSEC-2022-190

SQL Injection in Django

Published Apr 12, 2022 · Updated Feb 13, 2025 · Assigned by mitre

Description

An issue was discovered in Django 2.2 before 2.2.28, 3.2 before 3.2.13, and 4.0 before 4.0.4. QuerySet.annotate(), aggregate(), and extra() methods are subject to SQL injection in column aliases via a crafted dictionary (with dictionary expansion) as the passed **kwargs.

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 python-django 2:3.2.13-1 —
Debian 13 python-django 2:3.2.13-1 —
Debian 12 python-django 2:3.2.13-1 —
Debian 11 python-django 2:2.2.28-1~deb11u1 DSA-5254-1
Debian 10 python-django 1:1.11.29-1+deb10u3 DLA-3177-1
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Debian 9 python-django 1:1.10.7-2+deb9u16 DLA-2982-1
ReleasePackageFixed inAdvisory
Ubuntu 20.04 LTS python-django 2:2.2.12-1ubuntu0.11 USN-5373-1
Ubuntu 18.04 LTS python-django 1:1.11.11-1ubuntu1.17 USN-5373-1
Show 2 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 16.04 LTS python-django 1.8.7-1ubuntu5.15+esm5 USN-5373-2
Ubuntu Pro 14.04 LTS python-django 1.6.11-0ubuntu1.3+esm5 USN-5373-2
ReleasePackageFixed inAdvisory
Red Hat Satellite Utils 6 foreman 3.1.1.21-2.el7sat RHSA-2022:5498
Red Hat Satellite Utils 6 satellite 6.11.0-2.el7sat RHSA-2022:5498
Red Hat Satellite Capsule 6 foreman 3.1.1.21-2.el7sat RHSA-2022:5498
Red Hat Satellite Capsule 6 libsolv 0.7.22-1.el7pc RHSA-2022:5498
Red Hat Satellite Capsule 6 python-django +1 3.2.13-1.el8pc RHSA-2022:5498
Red Hat Satellite Capsule 6 python-lxml 4.7.1-1.el8pc RHSA-2022:5498
Red Hat Satellite Capsule 6 python-sqlparse 0.4.2-2.el8pc RHSA-2022:5498
Red Hat Satellite Capsule 6 satellite 6.11.0-2.el7sat RHSA-2022:5498
Red Hat Satellite 6 candlepin 4.1.13-1.el7sat RHSA-2022:5498
Red Hat Satellite 6 foreman 3.1.1.21-2.el7sat RHSA-2022:5498
Red Hat Satellite 6 libsolv 0.7.22-1.el7pc RHSA-2022:5498
Red Hat Satellite 6 python-django +1 3.2.13-1.el8pc RHSA-2022:5498
Red Hat Satellite 6 python-lxml 4.7.1-1.el8pc RHSA-2022:5498
Red Hat Satellite 6 python-sqlparse 0.4.2-2.el8pc RHSA-2022:5498
Red Hat Satellite 6 rubygem-actionpack 6.0.4.7-1.el8sat RHSA-2022:5498
Red Hat Satellite 6 rubygem-puma 5.6.2-1.el8sat RHSA-2022:5498
Red Hat Satellite 6 rubygem-sidekiq 5.2.10-1.el8sat RHSA-2022:5498
Red Hat Satellite 6 satellite 6.11.0-2.el7sat RHSA-2022:5498
Red Hat Satellite 6 tfm-rubygem-actionpack 6.0.4.7-1.el7sat RHSA-2022:5498
Red Hat Satellite 6 tfm-rubygem-puma 5.6.2-1.el7sat RHSA-2022:5498
Red Hat Satellite 6 tfm-rubygem-sidekiq 5.2.10-1.el7sat RHSA-2022:5498
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Red Hat Rhui 4 python-django 3.2.13-2.el8ui RHSA-2022:5602
Red Hat Rhui 4 python-pulpcore +1 3.17.6-3.el8ui RHSA-2022:5602
Red Hat OpenStack 16 python-django20 2.0.13-17.el8ost RHSA-2022:8872, RHSA-2022:5115
Red Hat OpenStack 16 python3-django20 +1 2.0.13-18.el8ost RHSA-2022:8872
Red Hat Ansible Automation Platform 4 python3-django 2.2.28-1.el7pc RHSA-2022:5703
Red Hat Ansible Automation Platform 2 automation-controller +4 4.1.2-2.el8ap RHSA-2022:5702
Red Hat Ansible Automation Platform 2 python-django +1 3.2.13-1.el8pc RHSA-2022:5702

Rocky Linux

Errata ↗
ReleasePackageFixed inAdvisory
Rocky Linux 8 libdb 5.3.28-42.el8_4 RLSA-2022:5498
ReleasePackageFixed inAdvisory
SUSE Package Hub 15 SP3 python-Django 2.2.28-bp153.2.3.1 openSUSE-SU-2023:0005-1
SUSE OpenStack Cloud Crowbar 9 grafana 6.7.4-3.29.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 openstack-heat-templates 0.0.0+git.1654529662.75fa04a7-3.15.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 openstack-horizon-plugin-gbp-ui 14.0.1~dev4-3.12.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 openstack-neutron-gbp 14.0.1~dev46-3.34.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 openstack-nova 18.3.1~dev92-3.43.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 python-Django1 1.11.29-3.40.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 rabbitmq-server 3.6.16-4.3.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 9 rubygem-puma 2.16.0-4.18.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud Crowbar 8 grafana 6.7.4-4.23.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud Crowbar 8 openstack-heat-templates 0.0.0+git.1654529662.75fa04a-3.27.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud Crowbar 8 openstack-murano +1 4.0.2~dev3-3.12.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud Crowbar 8 python-Django 1.11.29-3.42.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud Crowbar 8 rabbitmq-server 3.6.16-3.13.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud Crowbar 8 rubygem-puma 2.16.0-3.18.1 SUSE-SU-2022:3338-1
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SUSE OpenStack Cloud 9 ardana-ansible 9.0+git.1660748476.c118d23-3.32.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 ardana-cobbler 9.0+git.1660747489.119efcd-3.19.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 ardana-tempest 9.0+git.1651855288.a2341ad-3.22.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 grafana 6.7.4-3.29.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 openstack-heat-templates 0.0.0+git.1654529662.75fa04a7-3.15.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 openstack-horizon-plugin-gbp-ui 14.0.1~dev4-3.12.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 openstack-neutron-gbp 14.0.1~dev46-3.34.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 openstack-nova 18.3.1~dev92-3.43.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 python-Django1 1.11.29-3.40.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 rabbitmq-server 3.6.16-4.3.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 venv-openstack-heat 11.0.4~dev4-3.37.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 venv-openstack-horizon 14.1.1~dev11-4.41.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 venv-openstack-neutron 13.0.8~dev206-6.41.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 9 venv-openstack-nova 18.3.1~dev92-3.41.1 SUSE-SU-2022:3339-1
SUSE OpenStack Cloud 8 ardana-ansible 8.0+git.1660773729.3789a6d-3.85.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 ardana-cobbler 8.0+git.1660773402.d845a45-3.47.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 grafana 6.7.4-4.23.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 openstack-heat-templates 0.0.0+git.1654529662.75fa04a-3.27.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 openstack-murano +1 4.0.2~dev3-3.12.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 python-Django 1.11.29-3.42.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 rabbitmq-server 3.6.16-3.13.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 venv-openstack-heat 9.0.8~dev22-12.45.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 venv-openstack-horizon 12.0.5~dev6-14.48.1 SUSE-SU-2022:3338-1
SUSE OpenStack Cloud 8 venv-openstack-murano 4.0.2~dev3-12.38.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 ardana-ansible 8.0+git.1660773729.3789a6d-3.85.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 ardana-cobbler 8.0+git.1660773402.d845a45-3.47.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 grafana 6.7.4-4.23.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 openstack-heat-templates 0.0.0+git.1654529662.75fa04a-3.27.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 openstack-murano +1 4.0.2~dev3-3.12.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 python-Django 1.11.29-3.42.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 rabbitmq-server 3.6.16-3.13.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 venv-openstack-heat 9.0.8~dev22-12.45.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 venv-openstack-horizon-hpe 12.0.5~dev6-14.48.1 SUSE-SU-2022:3338-1
SUSE HPE Helion OpenStack 8 venv-openstack-murano 4.0.2~dev3-12.38.1 SUSE-SU-2022:3338-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed python-Django 4.0.4-1.1 openSUSE-SU-2025:14662-1, openSUSE-SU-2024:12094-1
openSUSE Tumbleweed python-Django4 4.2.14-1.1 openSUSE-SU-2026:11235-1, openSUSE-SU-2024:14208-1
openSUSE Tumbleweed python-Django5 5.2.16-1.1 openSUSE-SU-2026:11270-1
openSUSE Tumbleweed python-Django6 6.0-1.1 openSUSE-SU-2026:10005-1
openSUSE Leap 15.5 python-Django 2.0.7-150000.1.27.1 SUSE-SU-2024:2817-1
openSUSE Leap 15.3 python-Django 2.2.28-bp153.2.3.1 openSUSE-SU-2023:0005-1
ReleasePackageFixed inAdvisory
Alpine v3.24 py3-django 3.2.13-r0 —
Alpine v3.23 py3-django 3.2.13-r0 —
Alpine v3.22 py3-django 3.2.13-r0 —
Alpine v3.21 py3-django 3.2.13-r0 —
Alpine v3.20 py3-django 3.2.13-r0 —
Show 4 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 py3-django 3.2.13-r0 —
Alpine v3.18 py3-django 3.2.13-r0 —
Alpine v3.17 py3-django 3.2.13-r0 —
Alpine v3.16 py3-django 3.2.13-r0 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 4 repositories

  • DeEpinGh0st/CVE-2022-28346 ★ 24 · Apr 26, 2022

    Django QuerySet.annotate(), aggregate(), extra() SQL 注入

  • YouGina/CVE-2022-28346 ★ 2 · Apr 25, 2022

    SQL injection in QuerySet.annotate(), aggregate(), and extra()

  • kamal-marouane/CVE-2022-28346 ★ 1 · Jan 19, 2024

    A flaw was found in the Django package, which leads to a SQL injection. This flaw allows an attacker using a crafted dictionary containing malicious SQL queries to compromise the database completely.

  • vincentinttsh/CVE-2022-28346 ★ 0 · Mar 4, 2023

    An issue was discovered in Django 2.2 before 2.2.28, 3.2 before 3.2.13, and 4.0 before 4.0.4. QuerySet.annotate(), aggregate(), and extra() methods are subject to SQL injection in column aliases via …

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
PyPI django >= 2.2, < 2.2.28 2.2.28 GHSA-2gwj-7jmv-h26r
PyPI django >= 3.2, < 3.2.13 3.2.13 GHSA-2gwj-7jmv-h26r
PyPI django >= 4.0, < 4.0.4 4.0.4 GHSA-2gwj-7jmv-h26r
PyPI django >= 4.0, < 4.0.4 · >= 3.2, < 3.2.13 · >= 2.2, < 2.2.28 4.0.4, 3.2.13, 2.2.28 PYSEC-2022-190

Advisories 25

References