5.3.3 Ensure password hashing algorithm is SHA-512

Information

The commands below change password encryption from md5 to sha512 (a much stronger hashing algorithm). All existing accounts will need to perform a password change to upgrade the stored hashes to the new algorithm.

Notes:

These changes only apply to accounts configured on the local system.

Additional module options may be set, recommendation only covers those listed here.

Rationale:

The SHA-512 algorithm provides much stronger hashing than MD5, thus providing additional protection to the system by increasing the level of effort for an attacker to successfully determine passwords.

Solution

Edit the /etc/pam.d/password-auth and /etc/pam.d/system-auth files to include the sha512 option for pam_unix.so:

password sufficient pam_unix.so sha512

Notes:

Any system accounts that need to be expired should be carefully done separately by the system administrator to prevent any potential problems.

If it is determined that the password algorithm being used is not SHA-512, once it is changed, it is recommended that all user ID's be immediately expired and forced to change their passwords on next login, In accordance with local site policies.

To accomplish this, the following command can be used.

# awk -F: '( $3<''$(awk '/^s*UID_MIN/{print $2}' /etc/login.defs)'' && $1 != 'nfsnobody' ) { print $1 }' /etc/passwd | xargs -n 1 chage -d 0

See Also

https://workbench.cisecurity.org/files/2925

Item Details

Category: IDENTIFICATION AND AUTHENTICATION

References: 800-53|IA-5, 800-53|IA-5(1), CSCv7|16.4

Plugin: Unix

Control ID: cead0145af43b057c3b5489ea943df14dcfb083f93f5a45fdbfa352b1e75c38b