70 points · by 16s · 15y ago · 59 comments
More generally, hash functions are collision-resistant, but the output is not (pseudo)random.
Does this attack actually work, by the way? Don't you need to also be lucky with the padding and have the plaintext be an exact multiple of the bytes in the round?
The attack does work, see e.g. http://www.vnsecurity.net/t/length-extension-attack/. This example suggests that any padding should not matter; and even if it does, being able to mount this attack on a substantial part of visitors is bad. (Sorry for being vague here - I don't have the time to look at this properly now.)
For the average user, a scheme like this would be a vast improvement over their "123456 is secure enough, no?"-scheme.
Putting the face/facebook start at the front of the passpphrase string would fix that. So would an HMAC.
I agree that this scheme is probably fine as long as you're the only one using it and nobody is specifically targeting you; but if you're going to go to use a password manager (which would be an improvement in general - as you point out, "123456 is secure enough, no?" is prevalent), why not use a good password manager?
Edit: I think I understand what you are getting at now... what you suggest would require the use of a fully encoded SHA1_Pass generated password (not halves) and the user would have to be using a "sentence + salt" scheme where the sentence always stays the same in order for this to work in real life, right? Also, there are many other ways to use SHA1_Pass where your proposed attack would not work at all. What if they put the salt someplace in the middle? Or used entirely different sentences for different sites? How would you know?
It's not hard to imagine some practical difficulties for an attacker. But if you're writing this kind of software, you should get it right.
# generate our HMAC
hash = generate HMAC-SHA1 (facebook.com, passphrase) (String)
hash += SHA1(hash) # just need the extra length
# transform hash into a Passy
passy_chars = "ABCDEFGHabcdefgh23456789#$%*+=@?"
passy = ""
foreach octet in hash (starting with MSB)
passy += passy_chars[octet % 32]
# figure out the length of this passy
for i in 16 to passy.length
if passy.substr(0,i) is "good", return passy.substr(0,i)
where good means includes at least one from each of [A-H], [a-h], [2-9], and [#$%*+=@?]
I've implemented this in CoffeeScript, and have a minified version up here: http://dl.dropbox.com/u/11596/passy-tiny.htmlI have evolved this algorithm over the past decade. My requirements:
1. minimum of 80 bits of entropy (16*32=80)
2. must include at least one symbol, one uppercase, one lowercase, and one digit
3. base it on cryptographically secure hash algorithms
4. avoids confusing similar symbols O and 0, l and 1 and !, etc.
I realize that requirement #2 does nothing to increase entropy. It's simply there to satisfy (idiotic!) password requirements.With any of these systems, your generates passwords are still only as good as a) the strength of your passphrase, and b) the secrecy of your passphrase. As well as the obvious (physical security, keyboard sniffers, etc.)
It's not documented other than with comments, although I think the code is readable. You'll find test vectors in the source.
And, thanks!
1) All my passwords are stored on a piece of paper, in plain text. There is no need to encrypt, because only I know how I use it.
2) I don't need to back it up regularly. Just one backup, in case I lose the card, is enough.
3) Because I have to type in the passwords from it, I actually remember the ones I use regularly, so even if I lose the cards, I can log in to most things.
4) There is no "master password" to be exposed.
5) If I'm stupid enough to read it out loud, or run my finger along it whilst someone is watching, I might expose the parameters of one password, but everything else is still secure.
6) It is a piece of paper, the browser integration goes via my eyes and my fingers.
I did an implementation of it (http://www.loup-vaillant.fr/projects/password-generator)
require 'digest/sha1'
puts "doubly troubly"
thing = gets.chomp
base = Digest::SHA1.hexdigest(Digest::SHA1.hexdigest(thing))
puts base
puts base[0..3] + "^!!^E" + base[4..-1]
puts base[0..3] + "^!!^E" + base[4..6]
puts base[0..3] + "^!!^E"
For any site I input the domain (so "zach.tumblr.com" + my_salt would be inputed) then I copy one of the four outputs based on what security level I think the site deserves. THEN (and most critically) I add a password that rotates key characters based on factor X of the site. Think about this like a normal password, but it changes.I then expose this little piece of code on every one of my computers as well as on a protected server that lives only on an IP.
I 100% agree with this article, but I have my own system and it works well.
Shameless self-promotion link, if interested: https://chrome.google.com/extensions/detail/mjafhhefmkfchamf...
You can even this up, of course, with mnemonics and such, but a sentence like "I have got to get me one of THESE!" has less "mental entropy" than "aem1eePe{a".
I don't see how this is any more secure than having a normal password -- it's just security by obscurity. And in some sense it's worse, since you're led to believe these SHA1 passwords give you the same security as standard, locally-stored generated passwords.
Generally speaking, I go with the mnemonics, myself, rather than something like this.
What happens when the generated password doesn't meet the strength requirements for the site (too long/too short, not enough/too many numbers, not enough "special characters")? Or when I'm required to change my password periodically?
Requirements and restrictions on the password content could be handled similarly, by storing password formatting information for each site.
I never got around to implementing my system, because I got a fantastic deal on 1Password (via MacHeist) and my system became completely pointless.
http://akibjorklund.com/2009/supergenpass-is-not-that-secure
The SuperGenPass UI is rendered within the DOM of the current page when you click the bookmarklet. The UI is where you enter your master password. And because the UI is part of the current page, any script running in the page can read your master password. Remember that script can be external too, as in advertisements or widgets of some kind.
The main database is protected by a passphrase and/or keyfile (any file which won't change e.g. ~/Dropbox/Photos/2008/France/Photo5.jpg). One advantage of this is that a simple keylogger will be stumped by the keyfile - even if your passphrase is recorded an attacker still needs Photo5.jpg to decrypt the database.
It's originally a Windows app (http://www.keepass.info/), but is open-source and there's a fully featured Linux/OSX port called KeepassX (http://www.keepassx.org/)
Better to use the age old technique found in "Unix System Administration" by Evi Nemeth: Choose a well known phrase or poem or song lyrics. Then pick a letter from each word, and interpolate some weird chars. E.g.
Yellow Submarine In the town where I was born, Lived a man who sailed to sea...
First letter of each word: IttwIwbLamwsts then interpolate stuff, e.g. "IttwIwb$beatles1968$Lamwsts"
Still a pain in the ass to type, but not nearly as painful as a SHA1 or base64 string.
It is open source, portable (runs in Javascript), works on and offline and well designed. You can log in using a master passphrase, or a one-time password.
In fact, there are way too many exceptions out there in the wild. One still needs a notebook of some sort for such cases.
Also, the last time I've logged into Bitbucket (I [almost] don't use it, but I have the account) I forgot that I logged there using OpenID instead of login-password pair. :)
Having recently had some significant trouble with a lost online banking password, I've been thinking about keeping all my passwords in an encrypted file stored in various places (I don't like the idea of using a password manager, because it's difficult to move it across platforms). Is this sensible from a security POV? Which is the best encryption to use and is there a standard *nix tool for it?
http://keepass.info/download.html
It's much more convenient than a text file you cipher and decipher and it's more secure as well. A text file is prone to error (wrong copy/paste, forgot to cipher the file, etc.)
http://clipperz.com is a very portable password manager.
It works on your computer as well as online.
It relies on your browser being a "secure" Javascript interpreter. But then we do that every time we log into a web site.
Depending on your needs, you could also have a look at TrueCrypt (http://www.truecrypt.org/)
Maybe give users a choice: password or certificate.
I am still screwed by some passwords I rarely use because either
It a password that needs to be changed regularly and I forget where I am in the sequence.
The app had stupid requirements like the password has to be exactly 8 characters. Of course I truncate the generated string but never remember its truncated when I come back.
"SHA-1 is the most widely used of the existing SHA hash functions, and is employed in several widely-used security applications and protocols. In 2005, security flaws were identified in SHA-1, namely that a mathematical weakness might exist, indicating that a stronger hash function would be desirable."
"Earlier this week, three Chinese cryptographers showed that SHA-1 is not collision-free. That is, they developed an algorithm for finding collisions faster than brute force. SHA-1 produces a 160-bit hash. That is, every message hashes down to a 160-bit number. Given that there are an infinite number of messages that hash to each possible value, there are an infinite number of possible collisions. But because the number of possible hashes is so large, the odds of finding one by chance is negligibly small (one in 280, to be exact). If you hashed 280 random messages, you'd find one pair that hashed to the same value. That's the "brute force" way of finding collisions, and it depends solely on the length of the hash value. "Breaking" the hash function means being able to find collisions faster than that. And that's what the Chinese did. They can find collisions in SHA-1 in 269 calculations, about 2,000 times faster than brute force. Right now, that is just on the far edge of feasibility with current technology. Two comparable massive computations illustrate that point."
"It's time for us all to migrate away from SHA-1. Luckily, there are alternatives. The National Institute of Standards and Technology already has standards for longer -- and harder to break -- hash functions: SHA-224, SHA-256, SHA-384, and SHA-512. They're already government standards, and can already be used. This is a good stopgap, but I'd like to see more."