Make WordPress Core


Ignore:
Timestamp:
02/17/2025 11:22:33 AM (3 months ago)
Author:
johnbillion
Message:

Security: Switch to using bcrypt for hashing user passwords and BLAKE2b for hashing application passwords and security keys.

Passwords and security keys that were saved in prior versions of WordPress will continue to work. Each user's password will be opportunistically rehashed and resaved when they next subsequently log in using a valid password.

The following new functions have been introduced:

  • wp_password_needs_rehash()
  • wp_fast_hash()
  • wp_verify_fast_hash()

The following new filters have been introduced:

  • password_needs_rehash
  • wp_hash_password_algorithm
  • wp_hash_password_options

Props ayeshrajans, bgermann, dd32, deadduck169, desrosj, haozi, harrym, iandunn, jammycakes, joehoyle, johnbillion, mbijon, mojorob, mslavco, my1xt, nacin, otto42, paragoninitiativeenterprises, paulkevan, rmccue, ryanhellyer, scribu, swalkinshaw, synchro, th23, timothyblynjacobs, tomdxw, westi, xknown.

Additional thanks go to the Roots team, Soatok, Calvin Alkan, and Raphael Ahrens.

Fixes #21022, #44628

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/upgrade.php

    r59754 r59828  
    981981 * @ignore
    982982 * @since 1.2.0
     983 * @since 6.8.0 User passwords are no longer hashed with md5.
    983984 *
    984985 * @global wpdb $wpdb WordPress database abstraction object.
     
    993994            $newname = sanitize_title( $user->user_nickname );
    994995            $wpdb->update( $wpdb->users, array( 'user_nicename' => $newname ), array( 'ID' => $user->ID ) );
    995         }
    996     }
    997 
    998     $users = $wpdb->get_results( "SELECT ID, user_pass from $wpdb->users" );
    999     foreach ( $users as $row ) {
    1000         if ( ! preg_match( '/^[A-Fa-f0-9]{32}$/', $row->user_pass ) ) {
    1001             $wpdb->update( $wpdb->users, array( 'user_pass' => md5( $row->user_pass ) ), array( 'ID' => $row->ID ) );
    1002996        }
    1003997    }
Note: See TracChangeset for help on using the changeset viewer.