Make WordPress Core


Ignore:
Timestamp:
04/03/2025 01:51:28 PM (11 months ago)
Author:
johnbillion
Message:

Application Passwords: Correct the fallback behaviour for application passwords that don't use a generic hash.

Application passwords that aren't hashed using BLAKE2b should be checked using wp_check_password() rather than assuming they were hashed with phpass. This provides full back compat support for application passwords that were created via an overridden wp_hash_password() function that uses an alternative hashing algorithm.

Props snicco, debarghyabanerjee, peterwilsoncc, jorbin, johnbillion.

Fixes #63203

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-application-passwords.php

    r59828 r60123  
    503503        string $hash
    504504    ): bool {
     505        if ( ! str_starts_with( $hash, '$generic$' ) ) {
     506            /*
     507             * If the hash doesn't start with `$generic$`, it is a hash created with `wp_hash_password()`.
     508             * This is the case for application passwords created before 6.8.0.
     509             */
     510            return wp_check_password( $password, $hash );
     511        }
     512
    505513        return wp_verify_fast_hash( $password, $hash );
    506514    }
Note: See TracChangeset for help on using the changeset viewer.