来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] 74cms V3 4 20140709不好好的修改漏洞代码 而是修改过滤函数。虽然那过滤代码我绕不过去。。 但是还是找到了处能出数据。在修改过滤函数的基础上,还是好好的修改代码把。详细说明:首...
74cms V3.4.20140709 首先来看看过滤函数
function remove_xss($string) { $string = preg_replace('/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]+/S', '', $string); $parm1 = Array('javascript', 'union','vbscript', 'expression', 'applet', 'xml', 'blink', 'link', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); $parm2 = Array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); $parm3 = Array('alert','sleep','load_file','confirm','prompt','benchmark','select','update','insert','delete','create','alter','drop','truncate'); $parm = array_merge($parm1, $parm2, $parm3); for ($i = 0; $i < sizeof($parm); $i++) { $pattern = '/'; for ($j = 0; $j < strlen($parm[$i]); $j++) { if ($j > 0) { $pattern .= '('; $pattern .= '(&#[x|X]0([9][a][b]);?)?'; $pattern .= '|(�([9][10][13]);?)?'; $pattern .= ')?'; } $pattern .= $parm[$i][$j]; } $pattern .= '/i'; $string = preg_replace($pattern, '****', $string); } return $string; }
elseif ($act=='do_reg') { $captcha=get_cache('captcha'); if ($captcha['verify_userreg']=="1") { $postcaptcha=$_POST['postcaptcha']; if ($captcha['captcha_lang']=="cn" && strcasecmp(QISHI_DBCHARSET,"utf8")!=0) { $postcaptcha=iconv("utf-8",QISHI_DBCHARSET,$postcaptcha); } if (empty($postcaptcha) || empty($_SESSION['imageCaptcha_content']) || strcasecmp($_SESSION['imageCaptcha_content'],$postcaptcha)!=0) { exit("err"); } } require_once(QISHI_ROOT_PATH.'include/fun_user.php'); $username = isset($_POST['username'])?trim($_POST['username']):exit("err"); $password = isset($_POST['password'])?trim($_POST['password']):exit("err"); $member_type = isset($_POST['member_type'])?intval($_POST['member_type']):exit("err"); $email = isset($_POST['email'])?trim($_POST['email']):exit("err"); if (strcasecmp(QISHI_DBCHARSET,"utf8")!=0) { $username=iconv("utf-8",QISHI_DBCHARSET,$username); $password=iconv("utf-8",QISHI_DBCHARSET,$password); } $register=user_register($username,$password,$member_type,$email);
elseif($act=="add_save") { $setsqlarr['msgtype']=2; $setsqlarr['msgfrom']=trim($_SESSION['username']); $setsqlarr['msgfromuid']=intval($_SESSION['uid']); $toname=trim($_GET['toname']); $setsqlarr['message']=trim($_GET['msg']); if (strcasecmp(QISHI_DBCHARSET,"utf8")!=0) { $toname=iconv("utf-8",QISHI_DBCHARSET,$toname); $setsqlarr['message']=iconv("utf-8",QISHI_DBCHARSET,$setsqlarr['message']); } $msgtouser= $db->getone("select * from ".table('members')." where username = '{$toname}' LIMIT 1"); if (empty($msgtouser)) { exit('收件人不存在!'); } elseif ($msgtouser['uid']==$_SESSION['uid']) { exit("您不能给自己发消息!"); } elseif ($_SESSION['utype']=='1' && $msgtouser['utype']=='2') { $sql = "select did from ".table('company_down_resume')." WHERE company_uid = '{$_SESSION['uid']}' AND resume_uid='{$msgtouser['uid']}' LIMIT 1"; $info=$db->getone($sql); if (!empty($info)) { exit("您没有下载过会员<strong>{$msgtouser['username']}</strong>创建的简历,下载过简历后才可以给TA发短消息!"); } } $setsqlarr['msgtouid']=$msgtouser['uid']; $setsqlarr['msgtoname']=$msgtouser['username']; $setsqlarr['dateline']=time(); $setsqlarr['new']=1; $setsqlarr['replytime']=$setsqlarr['dateline']; $setsqlarr['replyuid']=$setsqlarr['msgfromuid']; inserttable(table('pms'),$setsqlarr);
修复方案:在这里对用户名做个验证把、 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com