CVE-2024-42005: Potential SQL injection in QuerySet.values() and values_list()
Django's QuerySet.values() and values_list() methods on models with a JSONField were vulnerable to SQL injection in column aliases via a crafted JSON object key passed as an argument. An attacker could inject SQL through this vector.
- Triaged in 5 days
- Fixed in 15 days
- Paid in 15 days
- Disclosed after 16 days
Summary by the program
###CVE-2024-42005: Potential SQL injection in QuerySet.values() and values_list()
QuerySet.values() and values_list() methods on models with a JSONField are subject to SQL injection in column aliases via a crafted JSON object key as a passed *arg.
Thanks to Eyal Gabay of EyalSec for the report.
This issue has severity "high" according to the Django security policy.
The report
Hi IBB :)
I found SQL injection in django. you can see my cve (CVE-2024-42005) here: https://www.djangoproject.com/weblog/2024/aug/06/security-releases/
Impact
QuerySet.values() and values_list() methods on models with a JSONField are subject to SQL injection in column aliases via a crafted JSON object key as a passed *arg.
NVD rated the vulnerability sevirity as 9.8. https://nvd.nist.gov/vuln/detail/CVE-2024-42005
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely insufficient validation or escaping of JSON object keys when used as column aliases in SQL queries generated by values() and values_list().
Impact
SQL injection in column aliases is possible; the text rates the issue high severity.
What the attacker needed
Application uses JSONField; attacker controls JSON keys passed to values()
The fix
The report links to a Django security release announcement.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Django is a web framework. On models with a JSONField, values() and values_list() can be given a crafted JSON object key as an argument, which can lead to SQL injection in column aliases.
What is SQL injection?
Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.