多语言展示
当前在线:641今日阅读:113今日分享:31

wordpress后台插件更新模块目录遍历漏洞补丁

建站程序:WORDPRESS漏洞提示:阿里云提示wordpress后台插件更新模块任意目录遍历导致DOS漏洞漏洞描述:WordPress后台文件/wp-admin/includes/ajax-actions.php中,对代码插件路径的输入参数plugin未进行正确的规范化转义,导致黑客可传入特殊路径,造成拒绝服务。本经验目的:一次性手动修复该漏洞,以后阿里云不再提示该漏洞,同时为您省下购买阿里云“安骑士”的昂贵费用。
工具/原料
1

WordPress后台文件/wp-admin/includes/ajax-actions.php

2

记事本或者notepad++等文本编辑工具来编辑/保存PHP文件

方法/步骤
1

1.在文件ajax-actions.php的3068行附近:$plugin = urldecode( $_POST['plugin'] );在这段代码后面加上:$plugin = plugin_basename( sanitize_text_field( wp_unslash( $_POST['plugin'] ) ) );

2

2.在文件ajax-action.php中大概3004行:if ( $plugin_update_data === true ) {    wp_send_json_error( $status ); }修改为:if ( $plugin_update_data === true ) {$status['error'] = __( 'Plugin update failed.' ); wp_send_json_error( $status ); }

3

3.找到3025行:if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {  $status['error'] = $wp_filesystem->errors->get_error_message();    } wp_send_json_error( $status ); } }修改为:if ( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {     $status['error'] = $wp_filesystem->errors->get_error_message();   } wp_send_json_error( $status ); } else {// An unhandled error occured$status['error'] = __( 'Plugin update failed.' ); wp_send_json_error( $status ); } }修改保存后,wordpress后台插件更新模块任意目录遍历导致DOS漏洞就修复好了!

推荐信息