Django is subject to SQL injection through its column aliases
djangoproject Django
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| django PyPI |
|
|
djangoproject Django
| Product | Affected | Fixed in |
|---|---|---|
| django PyPI |
|
|
An issue was discovered in Django 4.2 before 4.2.24, 5.1 before 5.1.12, and 5.2 before 5.2.6. FilteredRelation is subject to SQL injection in column aliases, using a suitably crafted dictionary, with dictionary expansion, as the **kwargs passed QuerySet.annotate() or QuerySet.alias().
From the CVE record · mitre
Django’s FilteredRelation is vulnerable to SQL injection in column aliases when a suitably crafted dictionary is expanded as keyword arguments to QuerySet.annotate() or QuerySet.alias(). An attacker can inject SQL under those conditions; the input does not specify network or local access, authentication requirements, or user interaction.
Engineers running the PyPI django package in affected Django 4.2 versions before 4.2.24, 5.1 versions before 5.1.12, or 5.2 versions before 5.2.6 should check their deployments.