Project

General

Profile

Actions

Bug #12800

closed

Suboptimal Password Hashing

Added by Sam K almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Authentication
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Release Notes:
Default
Affected Version:
2.6.0
Affected Architecture:

Description

This bug relates to Todo #10298: https://redmine.pfsense.org/issues/10298

The default password hashing algorithm has been changed from bcrypt to SHA-512. This significantly increases the risk of password hashes being cracked if they are obtained by an attacker.

Rough benchmark data suggest that SHA-512 hashes can computed more than two million times faster than bcrypt password hashes:

https://crypto.stackexchange.com/questions/46550/benchmark-differences-between-sha-512-and-bcrypt

bcrypt : bruteforce : ~                              400 H/s
         Wordlist + dive.rule :  ~                   550 H/s

sha512 : bruteforce : ~          870 MH/s ->   870000000 H/s
         Wordlist + dive.rule :  ~ 640 MH/s -> 640000000 H/s

Factor sha512 -> bcrypt : 1:1589473

In other words, a password hashed with bcrypt that would have required 24 hours to crack would require less than a second to crack if hashed with SHA-512 instead.
The references made to the Commercial National Security Algorithm (CNSA) Suite are not applicable to password hashing. As stated in the abstract of FIPS 180-4:

“This standard specifies hash algorithms that can be used to generate digests of messages. The digests are used to detect whether messages have been changed since the digests were generated.”

This is an entirely different use case to password hashing, which FIPS does not cover. The hashing recommendations made in FIPS are only appropriate for message digests, where speed, consistency and a low probability of collisions are vital. For password hashing, the slowest practical hash function should be used to increase the computational effort required to crack passwords.
A more secure password hashing approach should be implemented, further guidance for which is included below:

https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html

This could likely be achieved by using the password_hash PHP function, also linked below.

https://www.php.net/manual/en/function.password-hash.php

This issue also appears to affect FreeBSD at an operating system level.


Related issues

Related to Todo #10298: Use SHA-512 for user password hashesResolvedViktor Gurov02/27/2020

Actions
Related to Feature #12855: GUI option to select the user password hashing algorithmResolvedJim Pingle

Actions
Actions

Also available in: Atom PDF