From 7a7e45a530c7f081403d318a89ae0dd7cda5915c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 2 May 2018 02:19:25 +0000 Subject: [PATCH] Privacy: Use a CSPRNG in export filenames for more security. `rand()` is deterministic and therefore offers much less protection in this context. `wp_generate_password()` is a convenient wrapper around `wp_rand()`, which uses `random_int()` to generate cryptographically-secure psuedorandom numbers. Props iandunn. Merges [43045] to the 4.9 branch. See #43546. Built from https://develop.svn.wordpress.org/branches/4.9@43094 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42923 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/file.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/file.php b/wp-admin/includes/file.php index a50f7c43ae..e1392505f4 100644 --- a/wp-admin/includes/file.php +++ b/wp-admin/includes/file.php @@ -1905,7 +1905,7 @@ function wp_privacy_generate_personal_data_export_file( $request_id ) { $stripped_email = str_replace( '@', '-at-', $email_address ); $stripped_email = sanitize_title( $stripped_email ); // slugify the email address - $obscura = md5( rand() ); + $obscura = wp_generate_password( 32, false, false ); $file_basename = 'wp-personal-data-file-' . $stripped_email . '-' . $obscura; $html_report_filename = $file_basename . '.html'; $html_report_pathname = $exports_dir . $html_report_filename; diff --git a/wp-includes/version.php b/wp-includes/version.php index 856f18159c..48790ee6ec 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.6-alpha-43093'; +$wp_version = '4.9.6-alpha-43094'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.