CVE-2022-28346 SQL Injection in Django

Critical 9.8 Published Updated

Attackers can execute arbitrary SQL commands via crafted dictionary arguments in Django QuerySet methods, potentially accessing or modifying database contents.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-28346?

CVE-2022-28346 is a critical SQL injection vulnerability in Debian Debian Linux, published on 12 Apr 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

Weakness: CWE-89

Which versions are affected by CVE-2022-28346?

8 open source packages ship an affected version, including django and Django. It affects 2 products.

PackageAffectedFixed in
django BitnamiFrom 2.2.02.2.28, 3.2.13, 4.0.4
django PyPIFrom 2.22.2.28
django PyPIFrom 3.23.2.13
django PyPIFrom 4.04.0.4, 3.2.13, 2.2.28
django PyPIFrom 4.04.0.4
Django PyPIFrom 2.22.2.28
2 more packages
Django PyPIFrom 3.23.2.13
Django PyPIFrom 4.04.0.4
Linux distribution packages (1)
python-django20 Red Hat:openstack:16.2::el8All versions0:2.0.13-17.el8ost

Products include Debian Debian Linux, Djangoproject Django.

How do I fix CVE-2022-28346?

Upgrade django to a fixed version for your release line: 2.2.28, 3.2.13 or 4.0.4.

Use parameterised queries everywhere and never build SQL by joining strings. Upgrade affected software first; a web application firewall only buys time. More about SQL injection.

Is CVE-2022-28346 being exploited?

There is no known exploitation of CVE-2022-28346 in the wild and no public exploit code.

Public exploit code: 4 proofs of concept on GitHub.

All Debian Debian Linux vulnerabilities

Sources

Also known as BIT-django-2022-28346, DEBIAN-CVE-2022-28346, DLA-2982-1, GHSA-2gwj-7jmv-h26r, PYSEC-2022-190, RHSA-2022:5115 and 1 more.

Is CVE-2022-28346 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free