Skip to content
SQL injection Disclosed report Advanced CVE-2024-42005

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.

eyalsec Follow

Originally disclosed on HackerOne

Bounty$4,263 High View original
  • 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

The original report as published on HackerOne, by eyalsec. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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.

More by eyalsec

View all

3 more disclosed reports, best first.

More from Internet Bug Bounty

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

SQL injection

The lesson behind this report.

Input reaches a database query as code, letting an attacker read or change data the application never meant to expose.