Make WordPress Core


Ignore:
Timestamp:
09/19/2017 01:48:11 PM (9 years ago)
Author:
johnbillion
Message:

General: Add missing URL-encoding and add extra hardening to plugin and template names when they're displayed in the admin area.

Merges [41434] with changes to the 3.8 branch.

See #13377

Location:
branches/3.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.8

  • branches/3.8/src/wp-admin/plugins.php

    r40179 r41452  
    1818$action = $wp_list_table->current_action();
    1919
    20 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
     20$plugin = isset($_REQUEST['plugin']) ? wp_unslash( $_REQUEST['plugin'] ) : '';
    2121$s = isset($_REQUEST['s']) ? urlencode($_REQUEST['s']) : '';
    2222
     
    3838                        check_admin_referer('activate-plugin_' . $plugin);
    3939
    40                         $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
     40                        $result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . urlencode( $plugin ) ), is_network_admin() );
    4141                        if ( is_wp_error( $result ) ) {
    4242                                if ( 'unexpected_output' == $result->get_error_code() ) {
    43                                         $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
     43                                        $redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . urlencode( $plugin ) . "&plugin_status=$status&paged=$page&s=$s");
    4444                                        wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
    4545                                        exit;
     
    6868                        check_admin_referer('bulk-plugins');
    6969
    70                         $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
     70                        $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
    7171
    7272                        // Only activate plugins which are not already active.
     
    105105
    106106                        if ( isset( $_GET['plugins'] ) )
    107                                 $plugins = explode( ',', $_GET['plugins'] );
     107                                $plugins = explode( ',', wp_unslash( $_GET['plugins'] ) );
    108108                        elseif ( isset( $_POST['checked'] ) )
    109                                 $plugins = (array) $_POST['checked'];
     109                                $plugins = (array) wp_unslash( $_POST['checked'] );
    110110                        else
    111111                                $plugins = array();
     
    177177                        check_admin_referer('bulk-plugins');
    178178
    179                         $plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
     179                        $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();
    180180                        // Do not deactivate plugins which are already deactivated.
    181181                        if ( is_network_admin() ) {
     
    209209
    210210                        //$_POST = from the plugin form; $_GET = from the FTP details screen.
    211                         $plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
     211                        $plugins = isset( $_REQUEST['checked'] ) ? (array) wp_unslash( $_REQUEST['checked'] ) : array();
    212212                        if ( empty( $plugins ) ) {
    213213                                wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
Note: See TracChangeset for help on using the changeset viewer.