织梦member/reg_new.php SQL注入漏洞修复

1. 漏洞描述

Dedecms会员中心注入漏洞

2. 漏洞触发条件

/member/reg_new.php?dopost=regbase&step=1&mtype=%B8%F6%C8%CB&mtype=%B8%F6%C8%CB&userid=123asd123&uname=12asd13123&userpwd=123123&userpwdok=123123&email=1213asd123%40QQ.COM&safequestion=1','1111111111111','1389701121','127.0.0.1','1389701121','127.0.0.1'),('个人',user(),'4297f44b13955235245b2497399d7a93','12as11111111111111111d13123','','10','0','[email protected]','100', '0','-10','','1&safeanswer=1111111111111&sex=&vdcode=slum&agree=

//把vdcode=slum改成当前的验证码

3. 漏洞影响范围

4. 漏洞代码分析

/member/reg_new.php

..

$jointime = time();

$logintime = time();

$joinip = GetIP();

$loginip = GetIP();

$pwd = md5($userpwd); 

$spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);

//未对$mtype、$safeanswer、$safequestion进行有效过滤就带入SQL查询

$inQuery = "INSERT INTO dede_member (mtype ,userid ,pwd ,uname ,sex ,rank ,money ,email ,scores ,

matt, spacesta ,face,safequestion,safeanswer ,jointime ,joinip ,logintime ,loginip )

VALUES ('$mtype','$userid','$pwd','$uname','$sex','10','$dfmoney','$email','$dfscores',

'0','$spaceSta','','$safequestion','$safeanswer','$jointime','$joinip','$logintime','$loginip'); "; 

if($dsql->ExecuteNoneQuery($inQuery))

..

 

5. 防御方法

/member/reg_new.php

..

$jointime = time();

$logintime = time();

$joinip = GetIP();

$loginip = GetIP();

$pwd = md5($userpwd);

/* 对$mtype、$safeanswer、$safequestion进行有效过滤 */

    $mtype = HtmlReplace($mtype,1);

    $safeanswer = HtmlReplace($safeanswer);

    $safequestion = HtmlReplace($safequestion);

/* */

$spaceSta = ($cfg_mb_spacesta < 0 ? $cfg_mb_spacesta : 0);

$inQuery = "INSERT INTO dede_member (mtype ,userid ,pwd ,uname ,sex ,rank ,money ,email ,scores ,

matt, spacesta ,face,safequestion,safeanswer ,jointime ,joinip ,logintime ,loginip )

VALUES ('$mtype','$userid','$pwd','$uname','$sex','10','$dfmoney','$email','$dfscores',

'0','$spaceSta','','$safequestion','$safeanswer','$jointime','$joinip','$logintime','$loginip'); ";

if($dsql->ExecuteNoneQuery($inQuery))

{

..

红色部分是添加的代码

①本站所有织梦模板资源均来自用户分享和网络收集,如果侵犯了您的权益,请联系网站客服处理
②本站的源码程序都由博主亲自评测之后上架织梦楼。无毒无后门绿色安全。
③本站提供的织梦源码,均带数据及演示地址。可以在任一源码详情页查看演示地址。
④由于博主时间紧缺,所有模板源码不提供技术支持。仅部分收费原创源码提供售后
人民币与金币汇率为1比1,即1元=1金币
织梦楼 » 织梦member/reg_new.php SQL注入漏洞修复

发表评论

加入织梦楼永久VIP 海量资源免费下载

目前为止共有 322 位会员加入