Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2020-7471 PoC — Django SQL注入漏洞

Source
Associated Vulnerability
Title: Django SQL注入漏洞 (CVE-2020-7471)
Description:Django 1.11 before 1.11.28, 2.2 before 2.2.10, and 3.0 before 3.0.3 allows SQL Injection if untrusted data is used as a StringAgg delimiter (e.g., in Django applications that offer downloads of data as a series of rows with a user-specified column delimiter). By passing a suitably crafted delimiter to a contrib.postgres.aggregates.StringAgg instance, it was possible to break escaping and inject malicious SQL.
Description
django 漏洞:CVE-2020-7471  Potential SQL injection via StringAgg(delimiter) 的漏洞环境和 POC
Readme
### CVE-2020-7471 

这个仓库提供 CVE-2020-7471 Potential SQL injection via StringAgg(delimiter) 漏洞的环境和 POC 

### 受影响的 django 版本

- 1.11 到 1.11.28(不含)
- 2.2 到 2.2.10(不含)
- 3.0 到 3.0.3(不含)

### 下载使用前需要如下操作:

1. 安装 django 漏洞版本,我测试用的是

   ```python
   pip install django==3.0.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
   ```

2. 参考 [https://www.runoob.com/postgresql/windows-install-postgresql.html](https://www.runoob.com/postgresql/windows-install-postgresql.html) 完成 postgres 数据库的安装

3. 新建数据库

   ```sql
   CREATE DATABASE test;
   ```


4. 修改 sqlvul_projects/settings.py 里面的数据库配置,如果上一步你安装用的默认配置(包括设置密码为postgres),就无需修改任何配置,可以跳过这一步

   ```
   DATABASES = {
       'default': {
           'ENGINE': 'django.db.backends.postgresql',
           'NAME': 'test',         # 数据库名称
           'USER': 'postgres',
           'PASSWORD': 'postgres', # 数据库用户密码
           'HOST': '127.0.0.1',    # 数据库地址
           'PORT': '5432',
       }
   }
   ```

5. 通过 django 初始化数据表

   ```shell
   python3 manage.py migrate
   python3 manage.py makemigrations vul_app
   python3 manage.py migrate vul_app
   ```

然后运行 POC 脚本`CVE-2020-7471.py`就可以了

File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →