August 14, 2022
Django releases a security patch for SQL Injection vulnerability in its latest release

Django is a free and open-source, Python-based web framework that enables the rapid development of secure and maintainable websites. It is maintained by the Django Software Foundation.

Recently Django project has patched a high severity vulnerability in its latest releases.

Following the Django security policy, the Django team is issuing Django 4.0.6 and Django 3.2.14. We encourage all users of Django to upgrade as soon as possible.

Tracked as CVE-2022-34265, the potential SQL Injection vulnerability exists in Django’s main branch, and versions 4.1 (currently in beta), 4.0, and 3.2. New releases and patches issued today squash the vulnerability.

This issue has a severity “high” according to the Django security policy.

According to Web tech Survey, thousands of websites, including some popular brands in the U.S. alone choose Django as their Model-Template-View framework. That is why you need to upgrade or patch your Django instances against these bugs.

Researcher Takuto Yoshikai of Aeye Security Lab has reported this vulnerability to the Django Security team.

Security Patch releases to mitigate the potential vulnerability

Today, the Django team has released versions Django 4.0.6 and Django 3.2.14 that address a high-severity SQL injection vulnerability and they encourage all users of Django to upgrade as soon as possible.

CVE-2022-34265: The vulnerability can allow a threat actor to perform an SQL injection attack on Django web application via Trunc(kind) and Extract(lookup_name) arguments

Trunc() and Extract() database functions were subject to SQL injection if untrusted data was used as a kind/lookup_name value.

Applications that constrain the lookup name and kind choice to a known safe list are unaffected.

Affected supported versions

  • Django main branch
  • Django 4.1 (currently at beta status)
  • Django 4.0
  • Django 3.2


Patches to resolve the issue have been applied to Django’s main branch and the 4.1, 4.0, and 3.2 release branches. The patches may be obtained from the following changesets:

The following releases have been issued:

The PGP key ID used for this release is Mariusz Felisiak: 2EF56372BA48CD1B.

Security/Bug reporting

As always, If You find any bug or flaw you will report it via private email to [email protected], and not via Django’s Trac instance or the Django-developers list. If you want further information see the security policies of the Django project.

Leave a Reply

Your email address will not be published.