
django 漏洞:CVE-2020-7471 Potential SQL injection via StringAgg(delimiter) 的漏洞环境和 POC
This repository provides the environment and POC for CVE-2020-7471 Potential SQL injection via StringAgg(delimiter) vulnerability.
Install the vulnerable Django version. I used:
pip install django==3.0.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
Refer to https://www.runoob.com/postgresql/windows-install-postgresql.html to complete the installation of the PostgreSQL database.
Create a new database
CREATE DATABASE test;
Modify the database configuration in sqlvul_projects/settings.py. If you used the default configuration (including setting the password to postgres) in the previous step, no configuration changes are needed and you can skip this step.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'test', # 数据库名称
'USER': 'postgres',
'PASSWORD': 'postgres', # 数据库用户密码
'HOST': '127.0.0.1', # 数据库地址
'PORT': '5432',
}
}
Initialize the data tables via Django
python3 manage.py migrate
python3 manage.py makemigrations vul_app
python3 manage.py migrate vul_app
Then run the POC script CVE-2020-7471.py.