无限星辰工作室-客户无限互联网动力之源

标题: Discuz! 1.5-2.5 命令执行漏洞 修复方案(x1.5-x3.3都有) [打印本页]

作者: crx349    时间: 2018-9-4 12:47
标题: Discuz! 1.5-2.5 命令执行漏洞 修复方案(x1.5-x3.3都有)
漏洞说明:8月27号安全研究人员在GitHub上公布了有关Discuz 1.5-2.5版本中后台数据库备份功能存在的命令执行漏洞的细节。
适用版本:x1.5-x3.3
漏洞修复:
打开:
source\admincp\admincp_db.php
搜索:
313行
  1. @shell_exec($mysqlbin.'mysqldump --force --quick '.($db->version() > '4.1' ? '--skip-opt --create-options' : '-all').' --add-drop-table'.($_GET['extendins'] == 1 ? ' --extended-insert' : '').''.($db->version() > '4.1' && $_GET['sqlcompat'] == 'MYSQL40' ? ' --compatible=mysql40' : '').' --host="'.$dbhost.($dbport ? (is_numeric($dbport) ? ' --port='.$dbport : ' --socket="'.$dbport.'"') : '').'" --user="'.$dbuser.'" --password="'.$dbpw.'" "'.$dbname.'" '.$tablesstr.' > '.$dumpfile);
复制代码

改为
  1. @shell_exec($mysqlbin.'mysqldump --force --quick '.($db->version() > '4.1' ? '--skip-opt --create-options' : '-all').' --add-drop-table'.($_GET['extendins'] == 1 ? ' --extended-insert' : '').''.($db->version() > '4.1' && $_GET['sqlcompat'] == 'MYSQL40' ? ' --compatible=mysql40' : '').' --host="'.$dbhost.($dbport ? (is_numeric($dbport) ? ' --port='.$dbport : ' --socket="'.$dbport.'"') : '').'" --user="'.$dbuser.'" --password="'.$dbpw.'" "'.$dbname.'" '.escapeshellarg($tablesstr).' > '.$dumpfile);
复制代码


300行 搜索
  1. $tablesstr .= '"'.$table.'" ';
复制代码

改成
  1. $tablesstr.='"'.addslashes($table).'"';
复制代码


310行 搜索
  1. @unlink($dumpfile);
复制代码

下面加入
  1. $tablesstr=escapeshellarg($tablesstr);
复制代码


搜索
328行
搜索
  1. @unlink($dumpfile);
复制代码

加入
  1. $tablesstr=escapeshellarg($tablesstr);
复制代码



3.保存,替换同名文件,更新缓存
4.阿里云检查验证下 完成。
作者: crx349    时间: 2018-9-4 12:55
一位朋友分享的方法:
  1. $_SERVER['REQUEST_METHOD'] = 'POST';
  2. if(!submitcheck('exportsubmit')) {
复制代码


  1. if(!submitcheck('exportsubmit', 1)) {
复制代码

这个方法简单粗暴,貌似没用呢




欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://www.xmspace.net/) Powered by Discuz! X3.4