当前位置:网站首页>Cve-2019-14234 Django jsonfield SQL injection vulnerability
Cve-2019-14234 Django jsonfield SQL injection vulnerability
2022-07-19 05:00:00 【wavesky111】
One 、 Summary of vulnerability
Django It's a big and complete Web frame , It supports many database engines , Include Postgresql、Mysql、Oracle、Sqlite3 etc. , But with Django There is no better database than Postgresql 了 ,Django The official also suggested to cooperate with Postgresql Use it together . The reason for this vulnerability is that Django in JSONField The realization of the class ,Django Of model The most essential function is to generate SQL sentence , And in the Django adopt JSONField Generate sql When the sentence is , It's a simple string concatenation .
Two 、 Affects version
- Django Main development branch
- Django 2.2.x < 2.2.4
- Django 2.1.x < 2.1.11
- Django 1.11.x < 1.11.23
3、 ... and 、 Loophole principle
In fact, this is a SQL Another form of injection ——ORM Inject (Object Relational Mapping)
1.ORM What is it? :ORM It is a way of writing programs , In the past, when writing a program to check the database, it was code plus sql Statements are written together , When the program is huge, it is difficult to manage , It's hard to maintain . Later, the program and sql The sentences are separated . meanwhile ORM hold sql Is encapsulated , Program call is more convenient , It allows programmers to really pay attention to the logic layer code , Go to object-oriented programming ;
2. The cause of the vulnerability :queryset There is transform and lookup Two way , Are acted on “ Connect two tables through foreign keys ” and “ How to compare with the value inside ( By default exact)”. So as long as it is controlled queryset Key name of , The injection is natural , But there is a problem here .filter( ) There is no way to control the key name in , Only the key value can be controlled . But there is a situation , That is, the developer passes the entire object passed in by the user to filter() Function time , Users can control filter To further control queryset Key name of , To realize ORM Inject .—— come from phith0n The master :Django JSONField SQL Inject holes (CVE-2019-14234) Analysis and impact | Farewell song
Four 、 Loophole recurrence environment
Kali Linux + Vulfocus
Infiltration machine :Kali Linux
Drone aircraft :Vulfocus
5、 ... and 、 The experimental steps
1. Open the mirror environment , Access page ( Go directly to the backstage Collection Model management )


2. structure payload:http://192.168.117.131:58480/admin/vuln/collection/detail__a%27b=1


3. Recurrence is still very simple , The main thing here is to record ORM Inject the situation and ideas into .
6、 ... and 、 Repair method
Django Officials have released a new version that fixes the bug , Affected users are requested to upgrade and protect as soon as possible . upgrade Django To >=2.2.4、>=2.1.11、>=1.11.23 edition .
Django 2.2.4 Download address :
https://www.djangoproject.com/m/releases/2.2/Django-2.2.4.tar.gz
Django 2.1.11 Download address
https://www.djangoproject.com/m/releases/2.1/Django-2.1.11.tar.gz
Django 1.11.23 Download address :
https://www.djangoproject.com/m/releases/1.11/Django-1.11.23.tar.gz
——https://blog.csdn.net/weixin_42250835/article/details/121106792
7、 ... and 、POC
1.Poc_CVE-2019-14234 - wavesky - Blog Garden
2.https://github.com/wave-to/Poc/blob/main/Sql_or_ORM_injuection/Poc_CVE-2019-14234.py
边栏推荐
猜你喜欢

日志加入数据库实现思路

Mysql database table a data synchronization to table b

The database takes the fields of the configuration file, and then processes and judges the data

Conception finale: système distribué de gestion de la santé pour la prévention des épidémies hautement simultanées basé sur vue + socket + redis

elment-ui使用方法

CVE-2021-44228 Log4j 复现及原理
[email protected] : `node install. Problems of js`"/>solve [email protected] : `node install. Problems of js`

POC——DVWA‘s SQL Injection
![Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout](/img/8b/29027c2dee4ef764bb2e4b5b499a23.jpg)
Money making master applet [latest version 5.9.9] mall / instant withdrawal of commission / distribution promotion / phone recharge / is meituan hungry for takeout

OLTP Load Performance Optimization Practice
随机推荐
POC——DVWA‘s File Upload
FanoutExchange交换机简单使用
Embrace declarative UI
安装MySQL
Shallow chat link tracking
TiDB 性能分析和优化
邮箱发送邮件(包含附件,网易、QQ)
Codeforces Round #419 (Div. 1)B - Karen and Test
Swagger's pit
RestAPI
Overview of CKS core knowledge points
CVE-2020-10199 Nexus Repository Manager3远程命令执行漏洞复现
加密和解密
Conception finale: système distribué de gestion de la santé pour la prévention des épidémies hautement simultanées basé sur vue + socket + redis
Yiwen takes you to know about haproxy
CVE-2022-23131 Zabbix SAML SSO认证绕过漏洞
Cve-2020-10199 recurrence of nexus repository manager3 remote command execution vulnerability
知识图谱de构建与应用(五):知识推理
Construction and application of knowledge map de (VI): storage, service and quality of knowledge map
知识图谱de构建与应用(七):大规模知识图谱预训练