crx349 发表于 2018-9-4 12:47:58

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行
@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);
改为
@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行 搜索
$tablesstr .= '"'.$table.'" ';
改成
$tablesstr.='"'.addslashes($table).'"';

310行 搜索
@unlink($dumpfile);
下面加入
$tablesstr=escapeshellarg($tablesstr);

搜索
328行
搜索@unlink($dumpfile);
加入
$tablesstr=escapeshellarg($tablesstr);


3.保存,替换同名文件,更新缓存
4.阿里云检查验证下 完成。

crx349 发表于 2018-9-4 12:55:23

一位朋友分享的方法:
$_SERVER['REQUEST_METHOD'] = 'POST';
if(!submitcheck('exportsubmit')) {

if(!submitcheck('exportsubmit', 1)) {
这个方法简单粗暴,貌似没用呢
页: [1]
查看完整版本: Discuz! 1.5-2.5 命令执行漏洞 修复方案(x1.5-x3.3都有)