${discuz-admincp_db.php-vul} 命令执行漏洞 修复方案

    适用版本:x1.5-x3.3

    漏洞修复:

    打开:source\admincp\admincp_db.php

    搜索:

    313行 x3.4这部分最新版改了

    @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);

    保存,替换同名文件,更新缓存,完成。