SQL Injection in Django
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| django PyPI |
|
|
| Product | Affected | Fixed in |
|---|---|---|
| django PyPI |
|
|
2.2.4An issue was discovered in Django 1.11.x before 1.11.23, 2.1.x before 2.1.11, and 2.2.x before 2.2.4. Due to an error in shallow key transformation, key and index lookups for django.contrib.postgres.fields.JSONField, and key lookups for django.contrib.postgres.fields.HStoreField, were subject to SQL injection. This could, for example, be exploited via crafted use of "OR 1=1" in a key or index name to return all records, using a suitably crafted dictionary, with dictionary expansion, as the **kwargs passed to the QuerySet.filter() function.
From the CVE record · mitre
An error in shallow key transformation makes JSONField key and index lookups, and HStoreField key lookups, vulnerable to SQL injection. An attacker who can influence lookup names passed to QuerySet.filter() through dictionary-expanded keyword arguments could return all records. The input does not specify network access, authentication requirements, or user interaction.
Check applications using the PyPI django package in the 1.11.x series before 1.11.23, the 2.1.x series before 2.1.11, or the 2.2.x series before 2.2.4, including affected prereleases.