So, in ASP.NET,
System.WebHelpers.Crypto.HashPassword("123456");
will create a hashed, salted string that is unique every time. This is great; it means that if someone managed to get hold of a hashed password (say, in a SQL injection attack) they wouldn't be able to use lookup tables to find the original password. However, as far as I can see they WOULD still be able to easily write code to attempt to brute force it locally, without involving the victim's server, e.g.:
foreach(string passwordToTry in BigListOfCommonPasswords)
if (Crypto.VerifyHashedPassword(stolenHash,passwordToTry)) return passwordToTry;
... so wouldn't it be better to add your own extra salt when calling HashPassword, where the extra salt is stored outside of the database, e.g.:
System.WebHelpers.Crypto.HashPassword("123456"+getSaltFromWebConfig());
..., or is this pointless for some reason? Seems to me worth doing to make the above brute force attack much more difficult, but I've never seen this idea mentioned anywhere in usage examples for Crypto.HashPassword
, so is there something I'm missing?
EDIT: This isn't a duplicate of The necessity of hiding the salt for a hash . That question is asking whether an unhidden salt has any use to it at all. I'm not disputing that a salt stored in the same place as the hashed password is useful, or that passing an unsalted password to Crypto.HashPassword is useful. What I'm really getting at that adding your own, additional salt, stored elsewhere (even if it's the same for every user), provides an extra layer of protection on top of that provided by Crypto.HashPassword .
In the case of a SQL injection attack that exposed the database, the additional salt in, say, a web.config file, would still be protected (or would at least require an entirely different attack to access it).
System.WebHelpers.Crypto.HashPassword("123456"+getSaltFromWebConfig());
makes the hashed password much less useful for an attacker than
System.WebHelpers.Crypto.HashPassword("123456");
for certain types of attack and without much additional cost in terms of computing power or programming time.