diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 979536f751..7db3bbafd9 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -1923,6 +1923,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 8805c87052..e53607b467 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-beta3-46475'; +$wp_version = '5.3-beta3-46476'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.