Skip to content

Commit e5f74e0

Browse files
authored
Merge pull request #877 from dknauss/codex/fail-closed-nonce
Fail closed when CSPRNG is unavailable during nonce generation
2 parents 9d24967 + 2bf2cb5 commit e5f74e0

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

class-two-factor-core.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,7 +1304,7 @@ public static function create_login_nonce( $user_id ) {
13041304
try {
13051305
$login_nonce['key'] = bin2hex( random_bytes( 32 ) );
13061306
} catch ( Exception $ex ) {
1307-
$login_nonce['key'] = wp_hash( $user_id . wp_rand() . microtime(), 'nonce' );
1307+
return false;
13081308
}
13091309

13101310
// Store the nonce hashed to avoid leaking it via database access.

0 commit comments

Comments
 (0)