diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 6db2c27725..0c9bbdd852 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -1695,8 +1695,12 @@ class File_Upload_Upgrader { if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) wp_die( $uploads['error'] ); - $this->filename = $_GET[$urlholder]; + $this->filename = sanitize_file_name( $_GET[ $urlholder ] ); $this->package = $uploads['basedir'] . '/' . $this->filename; + + if ( 0 !== strpos( realpath( $this->package ), realpath( $uploads['basedir'] ) ) ) { + wp_die( __( 'Please select a file' ) ); + } } }