关联漏洞
标题:
Django SQL注入漏洞
(CVE-2019-14234)
描述:Django是Django基金会的一套基于Python语言的开源Web应用框架。该框架包括面向对象的映射器、视图系统、模板系统等。 Django 2.2.4之前的2.2版本、2.1.11之前的2.1版本和1.11.23之前的1.11版本中存在SQL注入漏洞。该漏洞源于基于数据库的应用缺少对外部输入SQL语句的验证。攻击者可利用该漏洞执行非法SQL命令。
描述
POC-Django JSONField/HStoreField SQL Injection Vulnerability (CVE-2019-14234)
介绍
# POC-Django JSONField/HStoreField SQL Injection Vulnerability Exploit (CVE-2019-14234)
Django released a security update on August 1, 2019, which fixes a SQL injection vulnerability in the two model fields of JSONField and HStoreField.
Reference link:
https://www.djangoproject.com/weblog/2019/aug/01/security-releases/
https://www.leavesongs.com/PENETRATION/django-jsonfield-cve-2019-14234.html
The vulnerability requires the developer to use JSONField/HStoreField; moreover, the field name of the queryset can be controlled. Django's built-in application Django-Admin is affected, which gives us an easy way to reproduce the vulnerability.
## Start Vulnerability Application
Compile and start a vulnerable Django 2.2.3 by executing the following command:
```
docker compose build
docker compose up -d
```
After the environment is started, you can see the home page of Django at http://your-ip:8000.
## Vulnerability Reproduce
First, log in to the Django-Admin `http://your-ip:8000/admin/` with username `admin` and password `a123123123`.
Then go to the list-view `http://your-ip:8000/admin/vuln/collection/` of the model `Collection`:
Add `detail__a'b=123` to the GET parameter, where `detail` is the JSONField:
http://your-ip:8000/admin/vuln/collection/?detail__a%27b=123
You can see that the single quote has been injected successfully, and the SQL statement reports an error:
文件快照
[4.0K] /data/pocs/7faf51b522a4cf54e67bfbd4db1d3b6790c406b7
├── [ 584] 0001_initial.py
├── [ 126] admin.py
├── [ 83] apps.py
├── [ 558] collection.json
├── [ 203] docker-compose.yml
├── [ 372] docker-entrypoint.sh
├── [ 293] Dockerfile
├── [ 0] __init__.py
├── [ 632] manage.py
├── [ 234] models.py
├── [1.4K] README.md
├── [3.1K] settings.py
├── [ 754] urls.py
└── [ 401] wsgi.py
0 directories, 14 files
备注
1. 建议优先通过来源进行访问。
2. 如果因为来源失效或无法访问,请发送邮箱到 f.jinxu#gmail.com 索取本地快照(把 # 换成 @)。
3. 神龙已为您对POC代码进行快照,为了长期维护,请考虑为本地POC付费,感谢您的支持。