来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] 注入 无限制front_class php 对 username 做了限制 但是 忘了 转义符if(preg_match( 39; ( 39;|) 39;, $_POST[ 39;username 39;]) || preg_match( 39; ( 39;|) 39;, $_GET[ 39;usernam...
注入..无限制 front_class.php 对 username 做了限制 但是 忘了\转义符
if(preg_match('/(\'|")/', $_POST['username']) || preg_match('/(\'|")/', $_GET['username']) || preg_match('/(\'|")/', $_COOKIE['login_username'])){ exit('非法参数'); }
function register_action() { if(front::post('submit')) { if(!config::get('reg_on')) { front::flash(lang('网站已经关闭注册!')); return; } if(config::get('verifycode')) { if(!session::get('verify') ||front::post('verify') != session::get('verify')) { front::flash(lang('验证码错误!')); return; } } if(front::post('username') != strip_tags(front::post('username')) ||front::post('username') != htmlspecialchars(front::post('username')) ) { front::flash(lang('用户名不规范!')); return; } 省略 注册并没有太多的限制
function login_action() { if(!$this->loginfalsemaxtimes()) if(front::post('submit')) { if(config::get('verifycode')) { if(!session::get('verify') ||front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')."<a href=''>".lang('backuppage')."</a>"); return; } } if(front::post('username') &&front::post('password')) { $username=front::post('username'); $password=md5(front::post('password')); $data=array( 'username'=>$username, 'password'=>$password, ); $user=new user(); $user=$user->getrow(array('username'=>$data['username'],'password'=>$data['password'])); if(!is_array($user)) { $this->login_false(); return; } $user=$data; cookie::set('login_username',$user['username']); cookie::set('login_password',front::cookie_encode($user['password'])); session::set('username',$user['username']); $this->view->from=front::post('from')?front::post('from'):front::$from; front::flash($this->fetch('user/login_success.html')); return; } else { $this->login_false(); return; } } $this->view->ologinlist = ologin::getInstance()->getrows('',50); }
function init() { if(!config::get('guestbook_enable')){ alerterror('留言本功能已关闭'); } $user=''; if(cookie::get('login_username') &&cookie::get('login_password')) { $user=new user(); $user=$user->getrow(array('username'=>cookie::get('login_username'))); } $this->view->user=$user; //放入数据
function index_action() { $this->list_action(); if(front::post('submit')) { if(!front::post('guesttel')) { front::flash(lang('请填写联系电话!')); return false; } if(!front::post('title')) { front::flash(lang('请填写标题!')); return false; } if(!front::post('content')) { front::flash(lang('请选择内容!')); return false; } if(config::get('verifycode')) { if(front::post('verify')<>session::get('verify')) { front::flash(lang('验证码错误!')); return false; } } front::$post['checked']=0; //关键就是这个了 如果user里面有数据的话 就用user的 我们 存入是123123\ 在sql中 会把后面的转义掉 if(empty($this->view->user)) { front::$post['userid']=0; front::$post['username']='游客:'.front::$post['nickname']; }else { front::$post['userid']=$this->view->user['userid']; front::$post['username']=$this->view->user['username']; } front::$post['adddate']=date('Y-m-d H:i:s'); front::$post['ip']=front::ip(); if (!get_magic_quotes_gpc()) { front::$post['content'] = front::$post['content']; } front::$post['title']=strip_tags(front::$post['title']); $data=front::$post; $insert=$this->_table->rec_insert($data);//组合语句并查询 if($insert<1) { front::flash(lang('留言失败!')); } else { if(config::get('email_gust_send_cust') && front::$post['guestemail']){ $title = "您在".config::get('sitename')."的留言已提交"; $this->sendmail(front::$post['guestemail'], $title, $title); } if(config::get('email_guest_send_admin') && config::get('email')){ $title = '网站在' . date('Y-m-d H:i:s') . '有新留言了'; $this->sendmail(config::get('email'), $title, $title); } if(config::get('sms_on') && config::get('sms_guestbook_on')){ sendMsg(front::$post['guesttel'],config::get('sms_guestbook')); } if(config::get('sms_on') && config::get('sms_guestbook_admin_on') && $mobile = config::get('site_mobile')){ sendMsg($mobile,front::$post['username'].'在'.date('Y-m-d H:i:s').'留言了'); } front::flash(lang('留言成功!')); $this->view->submit_success=true; if(front::get('t') == 'wap'){ front::redirect(url::create('guestbook/index/t/wap/success/'.time())); }else{ front::redirect(url::create('guestbook/index/success/'.time())); } } } }
array(13) { ["nickname"]=> string(8) "11111111" ["guesttel"]=> string(3) "123" ["guestemail"]=> string(6) "123123" ["guestqq"]=> string(6) "123123" ["title"]=> string(2) "ss" ["content"]=> string(6) "123213" ["verify"]=> string(4) "3VTQ" ["submit"]=> string(6) "????o¤" ["checked"]=> int(0) ["userid"]=> string(1) "3" ["username"]=> string(10) "123123213\" ["adddate"]=> string(19) "2014-06-25 15:39:36" ["ip"]=> string(9) "125.0.1.5" }
["userid"]=> string(1) "3" ["username"]=> string(10) "123123213\" ["adddate"]=> string(19) "2014-06-25 15:39:36" ["ip"]=> string(9) "125.0.1.5"
guesttel=123&nickname=11111111&guestemail=123123&guestqq=123123&title=ss&username=il&content=123213&verify=3vtq&submit=+%E6%8F%90%E4%BA%A4+
array(13) { ["guesttel"]=> string(3) "123" ["nickname"]=> string(8) "11111111" ["guestemail"]=> string(6) "123123" ["guestqq"]=> string(6) "123123" ["title"]=> string(2) "ss" ["username"]=> string(10) "123123213\" ["content"]=> string(6) "123213" ["verify"]=> string(4) "3VTQ" ["submit"]=> string(6) "????o¤" ["checked"]=> int(0) ["userid"]=> string(1) "3" ["adddate"]=> string(19) "2014-06-25 15:42:59" ["ip"]=> string(9) "125.0.1.5" } INSERT INTO `cmseasy_guestbook`(guesttel,guestemail,guestqq,title,username,content,userid,adddate) VALUES ('123','123123','123123','ss','123123213\','123213','3','2014-06-25 15:42:59')
修复方案:过滤 |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com