Forum OpenACS Q&A: Re: Usage of SHA-1 in OpenACS

Posted by Gustaf Neumann on
The commit [1] introduces stronger password hashes for OpenACS, targeted for the OpenACS 5.10.1.

This change introduces the possibility to use either the classical OpenACS password hash algorithm "salted-sha1" or the SCRAM password function "scram-sha-256". The latter can be used by (a) using the most recent version of NaviServer (from Sept 28, 2021 or newer) and (b) by configuring the password hash preferences via Kernel package parameter "PasswordHashAlgorithm". The package parameter can contain a list of multiple hash algorithms in preference order. The most preferred available algorithm is chosen.

By default, the "PasswordHashAlgorithm" is "salted-sha1", and the behavior is as before. After upgrading to the new version of acs-tcl and acs-kernel, the preference list can be configured. When a user logs in and the preferred available algorithm is different from the previously used algorithm, the upgrade is performed for the user automatically.

The usage of SHA1 in OpenACS is easily target of security audits. The biggest danger is that if somebody gets full access to the "users" table (e.g. when decommissioning a hard disk). In this case the hashes can be attacked with dictionaries by using some crypto hardware (when someone gets raw access to the DB, one has usually some other big problems). However, by using the "scram-sha-256" hash function this danger is substantially reduced. This function computes a password hash using PBKDF2 (Password-Based Key Derivation Function 2). This function is used to reduce vulnerabilities of brute-force
attacks against password hashes. The hash function of SCRAM is PBKDF2 [RFC2898] with HMAC as the pseudo-random function (PRF) and with dkLen == output length of HMAC == output length of the digest function. So, it uses a better hash algorithm (sha-256 vs. sha1) and applies this a high number of times (15K times for a password hash computation).

NaviServer supports as well the even better SCRYPT algorithm, but this is only available when NaviServer is compiled with OpenSSL 3.0 or newer. On the contrary, scram-sha-256 actually PKCS5_PBKDF2_HMAC) is available since OpenSSL 1.0.0 (2015).

All the improved hash functions require NaviServer with its tight integration to the crypto functions of OpenSSL.