Best practices for storing passwords securely in a database | by Neeraj Kushwaha | Jun, 2022 | #emailsecurity | #phishing | #ransomware

A hacker can also read passwords if you can.

Cupid Media hack exposed 42m online dating passwords Link

  • As the SQL statement is sent from the application to the database server, network packets are intercepted.
  • Analyzing SQL query logs on the database server. Assuming the attacker has access to the database server host, they may be able to access log files that record SQL statements executed by the database server.
  • Read data from database backup files on the server or on backup media.
  1. Passwords should not be recoverable from the database.
  2. Password lengths should not be guessed from the database.
  3. Different hashes should be used for passwords that are the same, or similar.

The downside of this approach

The 2012 LinkedIn hack refers to the computer hacking of LinkedIn on June 5, 2012. Passwords for nearly 6.5 million user accounts were stolen. In May 2016, LinkedIn discovered an additional 100 million email addresses and hashed passwords that claimed to be additional data from the same 2012 breach. Link

The downside of this approach

DK = PBKDF2(PRF, Password, Salt, c, dkLen)* PRF : pseudorandom function of two parameters with output length hLen (e.g., a keyed HMAC) 
* Password : master password from which a derived key is generated
* Salt : sequence of bits, known as a cryptographic salt
* c : number of iterations desired
* dkLen : desired bit-length of the derived key
* DK : generated derived key

But you can allow a user access in other ways.

  • Use Argon2id with a minimum configuration of 15 MiB of memory, an iteration count of 2, and 1 degree of parallelism.
  • If Argon2id is not available, use scrypt with a minimum CPU/memory cost parameter of (2¹⁶), a minimum block size of 8 (1024 bytes), and a parallelization parameter of 1.
  • For legacy systems using bcrypt, use a work factor of 10 or more and with a password limit of 72 bytes.
  • If FIPS-140 compliance is required, use PBKDF2 with a work factor of 310,000 or more and set it with an internal hash function of HMAC-SHA-256. Use a strong random number generator to create a salt. The US National Institute of Standards and Technology recommends a salt length of 16 bytes (128 bits). Take 32 bytes (256 bits) of output from PBKDF2 as the final password hash. Store the iteration count, the salt, and the final hash in your password database.
  • Consider using pepper to provide additional defense in depth.

Original Source link

Leave a Reply

Your email address will not be published.

ninety three − = eighty six