Is storing of passwords in sha-1 hashing secure?

Examines if SHA-1 hashing is still secure for password storage given new vulnerabilities, and discusses stronger alternatives like bcrypt and best practices.
On this page

Is storing of passwords in sha-1 hashing secure?

Excerpt

SHA-1 hashing for passwords is no longer recommended due to weaknesses enabling brute force attacks. More secure alternatives like bcrypt and scrypt are now preferred.


Introduction

In today’s digital world, password security is paramount. Hashing algorithms are commonly used to securely store password data. SHA-1 has been one of the most widely used hashing functions. However, security researchers have found vulnerabilities in SHA-1. This raises the question - is SHA-1 hashing still considered secure for password storage? This blog examines SHA-1 and its weaknesses, alternatives for password hashing, real-world breaches, and best practices for robust security.

What is SHA-1 Hashing?

SHA-1 or Secure Hash Algorithm 1 is a cryptographic hash function designed by the NSA. It takes an input string like a password and generates a 160-bit hash value. This hash value can then be stored instead of the actual password.

SHA-1 is fast to compute. Historically it was considered strong enough against brute force attacks. These made SHA-1 a popular choice for password hashing.

The Security Concerns with SHA-1 Hashing

In recent years, new attacks have exposed vulnerabilities in SHA-1:

  • Mathematical weaknesses make it possible to find SHA-1 collisions - two inputs with the same hash. This enables an attacker to potentially access accounts by finding a password that matches a compromised SHA-1 hash.

  • With modern GPUs, it has become trivial to brute force crack SHA-1 hashes and reveal the original passwords.

  • Organizations using unsalted SHA-1 hashes were left vulnerable to rainbow table attacks.

Overall, SHA-1 cannot be considered a secure algorithm for password storage anymore.

Alternatives to SHA-1 Hashing

More secure password hashing algorithms available today include:

  • SHA-256 - Offers 256-bit hashes and is cryptographically stronger against collisions.

  • bcrypt - Uses salts and configurable rounds of encryption to resist brute force attacks.

  • scrypt - Also utilizes salts and is memory-hard to make password cracking extremely slow.

These modern algorithms offer much better protection compared to SHA-1.

Case Studies and Real-World Examples

Several incidents have exposed the weaknesses of SHA-1 for password security:

  • LinkedIn - Used unsalted SHA-1 hashes which were quickly cracked by hackers, compromising millions of passwords.

  • Gawker - SHA-1 hashes were leaked which allowed easy decryption of user passwords using GPUs.

  • Dropbox - Also used plain SHA-1 hashing leaving passwords vulnerable if hashes were obtained.

These breaches demonstrate how using SHA-1 hashing can be disastrous if password databases are compromised.

Best Practices for Password Storage

To maximize password security, organizations should:

  • Use secure hashing algorithms like bcrypt or scrypt with added salt.

  • Enforce password complexity policies - longer passwords with complex character requirements.

  • Implement multi-factor authentication as an additional layer of security.

  • Limit login attempts to prevent brute force attacks.

  • Regularly audit and patch systems to address emerging threats proactively.

For users, having unique passwords for each service and using a password manager helps prevent password reuse across breached databases.

Conclusion

In summary, SHA-1 hashing is no longer considered secure for password storage due to cryptographic weaknesses enabling brute force and collision attacks. Alternatives like SHA-256, bcrypt and scrypt are recommended. Combined with strong passwords and multifactor authentication, password security can be significantly enhanced against modern threats.