## 漏洞信息: ThinkSNS开源微博系统,是智士的开源社交平台。采用PHP+MySQL技术平台,微博+应用的产品模式,同时拥有iphone、android客户端、wap、3G版界面。 ThinkSNS public/minify.php 存在任意文件包含漏洞,可被利用导致敏感信息泄漏。 ## 漏洞分析: 问题在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,...
## 漏洞信息: ThinkSNS开源微博系统,是智士的开源社交平台。采用PHP+MySQL技术平台,微博+应用的产品模式,同时拥有iphone、android客户端、wap、3G版界面。 ThinkSNS public/minify.php 存在任意文件包含漏洞,可被利用导致敏感信息泄漏。 ## 漏洞分析: 问题在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文件到服务器 然后包含即可被执行! 上传测试文件至目录/x.php,通过以下途径触发: ``` http://xxxxxx/public/minify.php?f=../x.php ``` ## 解决方案: 建议关注官官网更新,及时升级最新版本: http://www.thinksns.com