新增功能时,发现严重bug!!!

On 12/04/2011, in php, by kilobug

在为购谷新增商户会员功能时,突然发现一个非常严重的bug,可以空密码登录账号!!!

会员模块设计时,我参考a1.cn和ucenter的会员设计,设计了

public function getUid($uid, $passwd = null) {
       ........
       if(is_string($passwd)) { /* 判定密码 */
              ........
       }
       ........
}

通过调用getUid方法来判定账号密码是否匹配

但!!!

if(is_string($passwd))

这个判定是有隐患的!
当编写业务逻辑的程序员没将$passwd参数转换为字符串,就调用getUid,会导致:
故意构造登录参数,只传username而不传password参数就能登录对应账号!

解决:

if(func_num_args() == 2)

PS:这个bug涉及了后台和会员登录,若被人利用会非常严重

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">

无觅相关文章插件,快速提升流量