当前位置:WooYun >> 漏洞信息

漏洞概要 关注数(24) 关注此漏洞

缺陷编号:wooyun-2014-082291

漏洞标题:飞飞影视最新版前台无限制getshell

相关厂商:飞飞影视

漏洞作者: 路人甲

提交时间:2014-11-07 18:03

修复时间:2015-02-05 18:04

公开时间:2015-02-05 18:04

漏洞类型:文件包含

危害等级:高

自评Rank:10

漏洞状态:未联系到厂商或者厂商积极忽略

漏洞来源: http://www.wooyun.org,如有疑问或需要帮助请联系 [email protected]

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2014-11-07: 积极联系厂商并且等待厂商认领中,细节不对外公开
2015-02-05: 厂商已经主动忽略漏洞,细节向公众公开

简要描述:

飞飞影视最新版前台无限制getshell v2.9

详细说明:

任意文件包含:
demo站测试:

选区_074.jpg


代码分析:myaction.class.php

<?php
class MyAction extends HomeAction{
public function show(){
$id = !empty($_GET['id'])?$_GET['id']:'new';
echo $id;

echo '1111111111111111111111111111';
$this->display('my_'.trim($id));
echo $id;
echo '11111111111111111111111';
}
}
?>


$id变量来自于get,之后传到了display函数。display第一个参数是模板名称。
跟踪display函数,流程比较多。最后传递到fetch函数如下:view.class.php

public function fetch($templateFile='',$charset='',$contentType='',$display=false)
{
//die('errorcode');
echo 'fetch';
G('_viewStartTime');
// 使用null参数作为模版名直接返回不做任何输出
if(null===$templateFile) return;
// 网页字符编码
if(empty($charset)) $charset = C('DEFAULT_CHARSET');
if(empty($contentType)) $contentType = C('TMPL_CONTENT_TYPE');
header("Content-Type:".$contentType."; charset=".$charset);
header("Cache-control: private"); //支持页面回跳
header("X-Powered-By:ThinkPHP".THINK_VERSION);
//页面缓存
ob_start();
ob_implicit_flush(0);
// 自动定位模板文件
echo $templateFile;//edit by test
//die();
echo file_exists_case($templateFile);
if(!file_exists_case($templateFile))
echo '1111111111111';
//echo $templateFile.'code';//edit by test
$templateFile = $this->parseTemplateFile($templateFile);
$engine = strtolower(C('TMPL_ENGINE_TYPE'));
echo $engine;
if('php'==$engine) {
// 模板阵列变量分解成为独立变量
extract($this->tVar, EXTR_OVERWRITE);
// 直接载入PHP模板
include $templateFile;
}elseif('think'==$engine && $this->checkCache($templateFile)) {
// 如果是Think模板引擎并且缓存有效 分解变量并载入模板缓存
extract($this->tVar, EXTR_OVERWRITE);
//载入模版缓存文件
//include C('CACHE_PATH').md5($templateFile).C('TMPL_CACHFILE_SUFFIX');
}else{
// 模板文件需要重新编译 支持第三方模板引擎
// 调用模板引擎解析和输出
$className = 'Template'.ucwords($engine);
require_cache(THINK_PATH.'/Lib/Think/Util/Template/'.$className.'.class.php');
$tpl = new $className;
$tpl->fetch($templateFile,$this->tVar,$charset);
}
$this->templateFile = $templateFile;
// 获取并清空缓存
$content = ob_get_clean();
// 模板内容替换
$content = $this->templateContentReplace($content);
// 布局模板解析
$content = $this->layout($content,$charset,$contentType);
// 输出模板文件
return $this->output($content,$display);
}
/**


需要继续跟到这里模板类的fetch函数

// 模板文件需要重新编译 支持第三方模板引擎
// 调用模板引擎解析和输出
$className = 'Template'.ucwords($engine);
require_cache(THINK_PATH.'/Lib/Think/Util/Template/'.$className.'.class.php');
$tpl = new $className;
$tpl->fetch($templateFile,$this->tVar,$charset);


模板类的fetch函数最后调用了load函数,其中包含了最开始找到的$id变量。
load函数,直接include。

public function load($templateFile,$templateVar,$charset) {
$this->tVar = $templateVar;
$templateCacheFile = $this->loadTemplate($templateFile);
// 模板阵列变量分解成为独立变量
extract($templateVar, EXTR_OVERWRITE);
//载入模版缓存文件
include $templateCacheFile;
}

漏洞证明:

看之前的漏洞,说是这个站是官方demo,拿来测试一下。先利用日志记录,写入payload。之后包含日志文件。

选区_074.jpg

修复方案:

版权声明:转载请注明来源 路人甲@乌云


漏洞回应

厂商回应:

未能联系到厂商或者厂商积极拒绝