diff --git a/wp-includes/functions.php b/wp-includes/functions.php index c6542d62d9..17f3e45fbc 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1787,6 +1787,11 @@ function wp_mkdir_p( $target ) { return @is_dir( $target ); } + // Do not allow path traversals. + if ( false !== strpos( $target, '../' ) || false !== strpos( $target, '..' . DIRECTORY_SEPARATOR ) ) { + return false; + } + // We need to find the permissions of the parent folder that exists and inherit that. $target_parent = dirname( $target ); while ( '.' != $target_parent && ! is_dir( $target_parent ) && dirname( $target_parent ) !== $target_parent ) { diff --git a/wp-includes/version.php b/wp-includes/version.php index 98b96c60e6..31500d2be8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.2.4-alpha-46481'; +$wp_version = '5.2.4-alpha-46482'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.