Make WordPress Core


Ignore:
Timestamp:
02/11/2025 11:12:03 AM (5 months ago)
Author:
johnbillion
Message:

Security: Explicitly require the hash PHP extension and add requirement checks during installation and upgrade.

This extension provides the hash() function and support for the SHA-256 algorithm, both of which are required for upcoming security related changes. This extension is almost universally enabled, however it is technically possible to disable it on PHP 7.2 and 7.3, hence the introduction of this requirement and the corresponding requirement checks prior to installing or upgrading WordPress.

Props peterwilsoncc, ayeshrajans, dd32, SergeyBiryukov, johnbillion.

Fixes #60638, #62815, #56017

See #21022

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-session-tokens.php

    r54133 r59803  
    6969     */
    7070    private function hash_token( $token ) {
    71         // If ext/hash is not present, use sha1() instead.
    72         if ( function_exists( 'hash' ) ) {
    73             return hash( 'sha256', $token );
    74         } else {
    75             return sha1( $token );
    76         }
     71        return hash( 'sha256', $token );
    7772    }
    7873
Note: See TracChangeset for help on using the changeset viewer.