CVE-2022-28347: SQL Injection in Django
9.8
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.73597%
CWE
Published
4/13/2022
Updated
9/20/2024
KEV Status
No
Technology
Python
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
Django | pip | >= 2.2, < 2.2.28 | 2.2.28 |
Django | pip | >= 3.2, < 3.2.13 | 3.2.13 |
Django | pip | >= 4.0, < 4.0.4 | 4.0.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stemmed from two key points:
- QuerySet.explain() lacked validation for option names in **options parameters, allowing attackers to inject SQL through dictionary keys
- The PostgreSQL explain_query_prefix implementation expanded options directly into the SQL query without proper whitelisting/validation
The patch added:
- Regex validation (EXPLAIN_OPTIONS_PATTERN) in Query.explain()
- Option normalization and allow-list checking in PostgreSQL's explain_query_prefix
- Removal of the 'validates_explain_options' flag that previously disabled validation These changes confirm the vulnerable code paths were in these specific functions handling option processing for EXPLAIN queries.