Password Hashing In The Browser
There are rarely new ideas in cryptography - and I doubt this idea is particularly innovative - but I thought it would be worth discussing.
When I want to log in to a system on the web, I have to send that system my password. It is (one hopes) encrypted in transmission, but once it arrives at the server there is a brief window where the server holds my password in plaintext. It then hashes it and compares it to the hashed value it has stored in its database.
A malicious party could intercept the password either by sitting between me and the server - or by compromising the server itself. Or, a corrupt sysadmin could steal the password. Or, incompetence could lead to a range of easily cracked passwords leaking out.
Once you know my email address and found out my password - you can try it against of range of services.
So, how do we send the password without sending the password?
Suppose we have an HTML password field which insists on a minimum of 6 characters:
<input type="password" pattern=".{6,}">
Let's now add "encrypt the password with this algorithm before sending it":
<input type="password" encrypt="sha1" pattern=".{6,}">
Now, obviously SHA-1 isn't secure, but it means that I don't send hunter2
to the server, I send f3bbbd66a63d4bf1747940578ec3d0103530e21d
.
The server should not store the hash directly - but rather encrypt it first.
We could take it any further:
<input type="password" encrypt="bcrypt" salt="abc..." rounds="4" pattern=".{6,}">
That's probably a bit overkill - and you'd need to make sure you used the same configuration every time someone logs on - but it means no one other than you ever sees the password.
Is this worth taking further? Of course, if you can't trust a company to securely store your password properly, it's unlikely they'd implement this properly.
Andrew Coulton says:
Michael Bøcker-Larsen says:
Tom says:
Marcus Downing says:
famalam says:
olevel says:
Chineke Tobenna Philip says:
In my reasoning, during registration, the random salt (client salt) generated can still be intercepted by MITM attack and reverse engineered to generate the actual password (since the code to hash the password is at the client).
During login, the hashes for the user name are sent, which can be intercepted, and hacker can reverse engineer the client side hashing algorithm to recreate the actual password using the doubly (or three times) hashed password sent to the server. All the hashing information going through can still be intercepted on an insecure connection such plain HTTP and the hashing algorithms are easily accessed at the client.
I believe using HTTPS or SSL to secure communication is the best way, or perhaps using OAuth 2 or something. If not, you are simply adding indirection and it can be deciphered by a very intelligent hacker.
Am I missing something?