cmseasy 管理端越权(删除 修改 添加 产品 和 订单) 不花钱你懂的
看代码: manage_act.php:
function init() {
$user='';
$guest = front::get('guest');
if($guest=='1'&&config::get('opguestadd')) {
$user = 'Guest';
}else {
if(cookie::get('login_username') &&cookie::get('login_password')) {
$user=new user();
$user=$user->getrow(array('username'=>cookie::get('login_username')));
}
}
if(cookie::get('login_username') &&cookie::get('login_password')) {
$guestuser=new user();
$guestuser=$guestuser->getrow(array('username'=>cookie::get('login_username')));
}
$this->view->guestuser = $guestuser;
if(!$user &&front::$act != 'login'&&front::$act != 'register') front::redirect(url::create('user/login'));
$this->view->user=$user;
$this->_user=new user;
$this->table=front::get('manage');
if($this->table <>'archive'&&$this->table <>'orders') exit('PAGE NOT FOUND!');
$this->_table=new $this->table;
$this->_table->getFields();
第一步 如果我们不是匿名用户的话
if(cookie::get('login_username') &&cookie::get('login_password')) {
$user=new user();
$user=$user->getrow(array('username'=>cookie::get('login_username')));
}
就会走到这里 看到问题了吧 cookie::get('login_password') 没有做任何参与运算的东西 直接拿到user 第二步: 我们修改cookie:login_username=admin; 我们打印一下 当前用户是什么:
看到没有超级管理员用户 下来我们看看能干什么: case=manage&act=add&manage=archive 如果是这样的 那么archive的东西都能操作 比如list_action,add_action,edit_action,delete_action 都可以操作 case=manage&act=add&manage=orders 如果是这样的 那么也可以执行 list_action,add_action,edit_action,delete_action 当然是订单表的东西了 我们看看;
function edit_action() {
$from=session::get('from');
front::check_type(front::get('id'));
if(front::post('submit') &&$this->manage->vaild()) {
$this->manage->filter();
$info=$this->_table->getrow(front::get('id'));
if($info['userid'] != $this->view->user['userid'] ) {
front::flash('记录修改失败!(原因:未经授权!)');
header("Location: ".$from,TRUE,302);
exit;
}
if($info['checked']) {
front::flash('记录修改失败!(原因:已通过审核!)');
header("Location: ".$from,TRUE,302);
exit;
}
$this->manage->save_before();
$data=array();
$fieldlimit=$this->_table->getcols(front::$act=='list'?'user_manage':'user_modify');
$fieldlimits=explode(',',$fieldlimit);
foreach(front::$post as $key=>$value) {
if(preg_match('/(select|union|and|\'|"|\))/i',$value)){
exit('非法参数');
}
if(in_array($key,$fieldlimits))
$data[$key]=$value;
}
$update=$this->_table->rec_update($data,front::get('id'));
这里来自post的所有东西并且key 没有做unset操作 且现在具有权限了,那么我就可以任意修改订单的状态 证明,略去,只要证明目前的所有操作是在超级管理员底下即可
暂无临时解决方案
暂无官方解决方案
暂无防护方案
※本站提供的任何内容、代码与服务仅供学习,请勿用于非法用途,否则后果自负
暂无评论