views:

1185

answers:

6

I have an ASP.Net web application where I would like to implement cryptography for password security. I am not using SSL.

For that i studied and pick CRAM-MD5 algorithm for password authentication. I have implement javascript cram-md5 algorthim available at http://pajhome.org.uk/crypt/md5/

Here i would like to know that is there anyone used it and face that CRAM-MD5 authentication is decoded by hackers?

What are the possiblities of decoding CRAM-MD5 authentication?

+4  A: 

MD5 is no longer considered secure, see MD5 vulnerabilities. For a more secure implementation, choose a different hash algorithm (such as SHA-256 or better).

Greg Hewgill
Unfortunately, when it comes to hashed-based authentication standards, MD5 is the only game in town. No one has declared CRAM-MD5, HTTP Digest, or CHAP unsafe even though the weakness of MD5 is well-known. I think it's still safer to use those than implementing your own auth scheme.
ZZ Coder
ZZ coder: you are completely wrong, again. MD5 is not 'the only game' for this. Your advice is truly bad, please, nobody follow it, and zz coder yourself: accept that MD5 is dead, and do some research.
Noon Silk
Simply replacing MD5 by SHA-256 does not help that much. CRAM-MD5 has other serious weaknesses. E.g., it is possible to do offline dictionary attacks. There exist much better authentication protocols e.g. SRP.
Accipitridae
+1  A: 

From Wiki:

Protocol Weaknesses

 - No mutual authentication; client does not verify server.
 - Offline dictionary attack to recover password feasible after capturing a successful CRAM-MD5 protocol exchange.
 - Use of MD5 insufficient.
 - Carries server requirement for storage of reversibly encrypted passwords.

I'd be scared to use md5 hashing algorithm, as getting back the original password from hash can be done in few seconds, if password wasn't long enough (actually, you can google for md5 rainbow table, there are sites that will decode such hash in few seconds and give back the result ;) ).

Ravadre
+2  A: 

Implementing your own cryptography is generally seen as a bad idea.

Cryptographic algorithms have a lot of very specific demands, and if even one of them isn't met (and that usually happens when people do their own), it usually won't be all too much more secure than no crypto at all.

If you're not convinced, this Google Tech Talk should help.

Sebastian P.
+2  A: 

Don't self implement your hashing algorithm. There are well tested implementations in System.Security. As stated don't use MD5.

In addition you should salt your hashes. For example if you have a user table with a password field you can add a salt field that is simply an integer, or a guid, or even a timestamp, but something unique. The salt ensures you will not have hash collisions within your database. Here is a discussion on salting.

TheHurt
Thanks, nice example of hashing
Hemant Kothiyal
A: 

As others have advised; don't use MD5, ever, for anything.

But as to an actual answer, how badly is it broken:

Well, with any one-hash it's, well, one-way, so you can't 'decode' it in that sense. What you can do, however, is generate collisions much faster than is acceptable. This allows the attackers to force matches in things that wouldn't otherwise match. It makes any validation of inference of the type 'md5(this) = md5(that) so this = that' wrong. This breaks digital signatures, and all sorts of other things.

Stay away from MD5, in any form.

-- Edit

Oh, and just a note, that hashing the password is no replacement for SSL. SSL is used to ensure, to the client, that the site they are browsing is yours, and to protect general sending of data.

Hashing is about protecting your database from a possible compromise. (And you always need to hash with a salt; you store the salt right next to the username in the db).

Noon Silk
CRAM-MD5 is an authentication protocol. It's not about saving password in DB. You can't use hashed password with CRAM-MD5.
ZZ Coder
I'm happy to be downvoted out of spite; but people reading this: the information is correct. See http://en.wikipedia.org/wiki/CRAM-MD5 ; it confirms the insecurity, and you will find details of MD5's problems on wikipedia as well. It is very important that this algorithm is no longer used.
Noon Silk
@ZZ Coder: you are wrong. Read the article.
Noon Silk
The down vote is for you last paragraph "Hashing is about protecting your database from a possible compromise.". That's totally out of the context and confusing. CRAM-MD5 requires timestamp in challenge so it can't be used in protecting database. Actually, it prevents you from using any hashed passwords in database. Please read http://www.ietf.org/rfc/rfc2195.txt
ZZ Coder
zz coder: please, stop giving such terrible advice.
Noon Silk
Hey, I think you both are right in your context. CRAM-MD5 is a one way authentication protocol hence the chance of decode is high compare with other avilable protocol.If we want to transfer secured data then we should always go with SSL .Here i would i like to know trusted certificate authority?
Hemant Kothiyal
Hemant: He's not right though; nothing with MD5 is safe. A trusted authority? Heaps. Thwate, VeriSign, etc. All listed in your browser.
Noon Silk
+1  A: 

Contrary to what others are saying, CRAM-MD5 is standard and safe to use. It's widely used in SASL for IMAP/SMTP authentication. You might be reading your EMail using CRAM-MD5. The other standard hashing algorithms are HTTP Digest Authentication and CHAP used in PPP but they all uses MD5 due to historical reasons. You can choose more secure SHA1-based hash but you will have to roll your own challenge schemes.

Because it uses challenge/response scheme, it's less vulnerable to the weakness of the MD5 hash. Unless you have special security requirements, stay with one of the standard algorithms.

ZZ Coder
SHA1 is dead as well. Nothing with 'MD5' in it is safe to use.
Noon Silk
Thnaks for great participation and providing useful help. As per i know i think i should go with SSL because using our own algorithm implementation using CRAM-MD5 have minor doubt of decode.I think its not good to go with doubt. Can anyone help me to find out good SSL Certificate because i have found larger list some of them are verisign, Thawte etc...
Hemant Kothiyal
There is no practical attack against HMAC-MD5 yet. However, the weaknesses of MD5 are so serious that it is bad advice to recommend any MD5 based algorithms for new implementations. Those that are using HMAC-MD5 or something similar don't have to panic, but still should replace it as soon as possible.
Accipitridae