I hear about all these websites getting hacked with sql injections and stuff. What's preventing them from encrypting the hashes with a 32 character string? If I were a hacker and I managed to get the database and I came across encrypted hashes I would not be able to do anything with the database as I do not know the encryption algorithm and the key.
As long as the key being stored securly everyones account would be safe.
Your idea of encrypting the hashes will indeed improve the security of the users password, but you should understand what exactly you are solving with this measure and what not.
First and most important, encryption on passwords is usually frowned upon, because it is a weak protection. If an attacker has the key, he can instantly discover all passwords. So the encryption does not relieve you from properly hash passwords with a slow algorithm like BCrypt, SCrypt, PBKDF2 or Argon2.
But your question was about encrypting the hashes. There is a case where even properly hashed and salted passwords can be recovered easily. If the user has choosen a very weak password, a dictionary attack will reveal them very fast anyway. If the hashes are encrypted though, the attacker needs the key, before he can start with the dictionary. This leads us to the following situation:
Encrypting the hashes will protect weak passwords, as long as the key stays secret. This is always the case when the attacker has no privileges on the server, examples are SQL-injection, disregarded servers, backups, ... I tried to describe this at the end of my tutorial about safely storing passwords.
Related
A third-party application states that TDE is used for encrypting the password database.
I don't know how appropriate this is for password storage as surely a decryption key still exists despite the fact that it is itself encrypted. The third-party state that internal staff do not have access to the passwords but I'm struggling to understand how that can be true as my understanding of encryption would not agree.
I've spent some time googling and whilst i understand the concept of TDE at a high-level, I am not convinced it's appropriate for storing customer passwords and claiming that no internal staff member can access these passwords.
Any comment or clarification would be much appreciated!
We have a legacy application that is storing the user's passwords down in the database unencrypted. We've had a fair few customers come onboard now which encrypting this password is a big deal to them (fair enough). Currently it's just a Nvarchar(100) field inside an SQL Server database table.
The situation is that we have multiple client applications accessing this database and validating against this password.
Just wanting to get advice on how we can achieve encryption on this field in the database without having to rewrite all the client applications that read off of it? It's not out of the question to change the client applications but we're trying to get away with this with as little fuss as possible.
Any ideas?
Do not do that, store salted, iterated HMACs of the passwords. Use something like Bcrypt, password_hash, PBKDF2 or similar.
If the HMAC is not salted and iterated it is not sufficient. Simply hashing without salting leaves the hashed passwords open to rainbow table attacks.
Convert the existing passwords now.
I am developing ASP.NET web application for a financial institution that is accessible by authenticated users. As a requirement, password for each user need to be encrypted so that Database Administrators can't have access to any user's password. I have gone through various types of encryption and hashing algorithms, but not sure which can be best suited for my requirement.
Whenever possible, prevent storing passwords all together, for instance by using Windows Authentication. If that is not possible, use the industries best practices in storing passwords. This means that you should:
Use password hashing (not encryption)
Add a salt to the hash
Use a computational intensive hashing algorithm.
The big danger of storing passwords is that the passwords of thousands of users get compromised when someone breaks into your system (or your DBA steals them). Although you can every user's password in your system, users usually use the same password over and over again and this means that the user is at risk when their password is compromised. Of course it is of course bad practice to reuse passwords, this is what users do and it is our job to at least minimize the risk for our users by doing anything that is within our power to do so. Don't forget that failing to do so, might even cause your company to get sued. This happened with LinkedIn.
So for password hashing this practically means that password hashing using MD5 and SHA (even with salting) is pretty useless, since those algorithms are optimized for speed, which allows hackers compute 2300 million salted hashes per second (brute force).
Some well-known computational intensive hashing algorithm are PBKDF2, Bcrypt, PBMAC, and scrypt. In .NET there's an PBKDF2 implementation named Rfc2898DeriveBytes. Here's a good example of the use of Rfc2898DeriveBytes (complete with configurable computational intensiveness, which allows this method to allow to withstand ever increasing computing power of computers).
Using some well-known frameworks that implement best-practices might be a good idea as well. #trailmax already suggested the AspNet Identity framework, which uses PBKDF2. However, prevent from using ASP.NET's SqlMembershipProvider, since it uses SHA by default, and it's actually quite hard to reconfigure it to use a safe method.
I'm encrypting some data that needs to stay on the client, and so will the Salt, Key and IV. Is there a standard way of handling this data on the client to prevent people from discovering it and encryption your data?
I can think of plenty of things to obscure them, but there must be an industry standard way of dealing with this issue.
There's no additional security risk if the IV and salt are known. IV's are safe to store in the clear, and salts are to help prevent precomputation and rainbow tables.
So you're really just talking about the key. There's a couple solutions, each with it's own tradeoffs. In your question, you only mention you need to encrypt data on the client. Does the client not need to decrypt?
If this is a Windows client, you can use the Data Protection API to protect the key under the users credentials.
Protect the key with a passphrase. If you don't mind entering a passphrase each time the client needs the key, this can offer reasonable protection, and it's supported in most cryptosystems like OpenPGP.
If the client only needs to encrypt, you can use a hybrid approach with public keys (like OpenPGP). In this case, you only store the public key on the client, and the private key somewhere safe. When you encrypt data, you'll generate a random symmetric key, and encrypt that under the client's public key. Now if someone compromises the machine, they won't be able to decrypt any of the session keys.
Use specialized hardware like a hardware security module or smart card. This is the most expensive route, but depending on your threat model might be viable.
Given a site that uses the default ASP.NET Membership Provider and the membership password format is configured to use hashing and the hash algorithm is SHA1 (the default; same one used by LinkedIn) and assuming the membership database is breached, are there any additional steps that can be taken to further mitigate exploitation of said data?
From quickly looking at the membership schema, passwords seem to utilize a salt key. Is this measure sufficient?
To make things short: for storing passwords, you should never go with MD5, SHA1, SHA256, SHA512, SHA-3, etc... bcrypt is the only safe way to store a password.
Here is the why of the affirmation above:
Since my question a while back
Is this the way to salt and store a Password in Db?
I started to use BCrypt as my password hashing code, and from what I keep reading, even if you get hold of the users table, it is pretty difficult from that get the plain text of the storage password.
I use this in my Custom Membership Provider so I get to host my own passwords.
From the blog post:
Why BCrypt? Most popular password storage schemes are based on fast hashing algorithms such as MD5 and SHA-1. BCrypt is a computationally expensive adaptive hashing scheme which utilizes the Blowfish block cipher. It is ideally suited for password storage, as its slow initialization time severely limits the effectiveness of brute force password cracking attempts. How much overhead it adds is configurable (that's the adaptive part), so the computational resources required to test a password candidate can grow along with advancements in hardware capabilities.
From codahale.com you can also read How to safely store a password as well...
By the way, BCrypt project is on Codeplex