diff --git a/wp-admin/includes/class-wp-upgrader.php b/wp-admin/includes/class-wp-upgrader.php index 5d2370d090..067184cbd3 100644 --- a/wp-admin/includes/class-wp-upgrader.php +++ b/wp-admin/includes/class-wp-upgrader.php @@ -2330,8 +2330,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' ) ); + } } }