多语言展示
当前在线:697今日阅读:168今日分享:49

Discuz! 1.5-2.5 命令执行漏洞 修复方案

漏洞说明:8月27号安全研究人员在GitHub上公布了有关Discuz 1.5-2.5版本中后台数据库备份功能存在的命令执行漏洞的细节。适用版本:x1.5-x3.3
工具/原料
1

Discuz!

2

Notepad++

方法/步骤
1

漏洞修复:打开: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);

2

300行(大约) 搜索$tablesstr .= '''.$table.'' ';改成$tablesstr.='''.addslashes($table).''';

3

310行 和 328行搜索@unlink($dumpfile);  改为$tablesstr=escapeshellarg($tablesstr);

4

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

注意事项

用编辑器尽量别用记事本

推荐信息