SitePoint Sponsor

User Tag List

Results 1 to 25 of 25
  1. #1
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    MD5 password encryption ..... errr... not safe ?

    guys...
    as you already know, PHP has this encryption technology called MD5.
    It is used to encrypt passwords when people sign up.

    but the problem is, I found a website that has "MD5 conversion and MD5 reverse lookup". For example when i enter in - 827ccb0eea8a706c4c34a16891f84e7b , it decrypts my password to 12345.

    so if the hackers gain access to my server sql database.. they can easily see all my clients passwords even though its encrypted.

    what are your views on this issue ?

    Thanks

  2. #2
    SitePoint Addict
    Join Date
    Jul 2008
    Location
    sudo rm -rf /
    Posts
    386
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It would decrypt it because it's too common password. Encrypt the following with md5:
    {}{}GgEWf{ER}Gkrjgn3$:*8734737^$#"CEW:EWFER

    and try.

    btw what is the site?

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by buldozerce View Post
    btw what is the site?
    There's a few out there.
    I find www.md5decrypter.co.uk seems to have the largest database for reverse lookups, but it still only has 5,000Million or so.

    I used it to do a lookup of the passwords used by people in work to justify spending development time updating our security systems
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  4. #4
    SitePoint Member
    Join Date
    Mar 2009
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MD5() Is not an invertible function so the password only can be encrypted by it , for decryption two methods are available :
    1. brute force 2. using database

    THERE IS NO WAY TO REVERSE THE MD5 HASHES ...
    I think that site you said is using a wide database , the database stores hashes like this structure :

    Code:
    1 = the hash of '1';
    12 = the hash of '12';
    123 = the hash of '123';
    ...........
    And when you give it a hash , it searches between hashes saved , that's it .
    Last edited by Sc0rpion; Mar 2, 2009 at 10:30.
    http://sc0rpion.ir
    http://blog.sc0rpion.net

    Just an interested PHP programmer ...

  5. #5
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Mark Baker View Post
    There's a few out there.
    I find md5decrypter seems to have the largest database for reverse lookups, but it still only has 5,000Million or so.
    yup thats the site I am talking about...

    ---------------------------------------------------------------------

    so the concern here is......

    if my MySql administrator is a naughty guy....
    he could easily see all my clients passwords.... hack into them easily

  6. #6
    SitePoint Enthusiast the-webber's Avatar
    Join Date
    Mar 2009
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just do some combination of md5 with sha1 or the like. sha1 is supposed to be less breakable (i believe)..but i don't think that all the websites that use md5 hashing for passwords are in overwhelming danger.

  7. #7
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by the-webber View Post
    just do some combination of md5 with sha1 or the like. sha1 is supposed to be less breakable (i believe)..but i don't think that all the websites that use md5 hashing for passwords are in overwhelming danger.
    yeah good idea.
    the danger is not outsider hackers..

    but insider people.

  8. #8
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Even using MD5, a well salted password is unlikely to be cracked using a lookup site, especially if you change the salt whenever the password is changed.

    It's only a matter of time before some of these lookup sites start building a database of sha1/sha2 lookups as well
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  9. #9
    Twitter: @AnthonySterling silver trophy AnthonySterling's Avatar
    Join Date
    Apr 2008
    Location
    North-East, UK.
    Posts
    6,111
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    A more advisable way is hash (md5 or sha1) the users password with a user specific salt, these site which offer to 'decrypt' hash merely compare them with a library of previously hashed values.
    @AnthonySterling: I'm a PHP developer, a consultant for oopnorth.com and the organiser of @phpne, a PHP User Group covering the North-East of England.

  10. #10
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by SilverBulletUK View Post
    A more advisable way is hash (md5 or sha1) the users password with a user specific salt
    very interesting word "salt"

    errrr forgive me.. but ermm.. what is the "salt" thinggii ??

  11. #11
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by akstar View Post
    errrr forgive me.. but ermm.. what is the "salt" thinggii ??
    At it's simplest level:
    PHP Code:
    $salt '1{+&34'// or some impossible to guess value
    $password 'My password';
    $hashedpassword md5($salt.$password
    You can make the salt a value unique to that user, and possibly also one that will change such as 'date/time' or last password reset.
    As long as you have access to the salt information when doing the password comparison, you can generate the same md5 as held on the user record in the database.

    I actually bit-adjust the user's password with the salt value rather than simply appending the two together, and have a rathe rmore secure salt than a hard-coded value in my scripts, but the principle is still the same.
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  12. #12
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ahhh... i understand what is salt now.
    Thanks so much Mark =)

  13. #13
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    and also , thanks everyone for posting and good advice.
    I am so happy I found this forum =)

  14. #14
    SitePoint Guru
    Join Date
    Dec 2005
    Posts
    982
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @OP The correct term is Rainbow tables. Wiki has some very useful information: http://en.wikipedia.org/wiki/Rainbow_table

    Also, I remember a thread on here previously that highly recommended against double hashing because it greatly increases collisions. Stick to the md5 ( password + salt ) method.
    MySQL v5.1.58
    PHP v5.3.6

  15. #15
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I was just going to post the same thing. The correct term for it is Rainbow Table. Here's a blog entry I read about it a couple of years ago:

    http://www.codinghorror.com/blog/archives/000949.html

  16. #16
    SitePoint Enthusiast akstar's Avatar
    Join Date
    Feb 2009
    Posts
    75
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Brandon and Timmy for the good advice. =)

  17. #17
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Just to add onto what has been said above, while MD5 has been proven insecure to be used alone, SH1 has yet to be broken. I find generating a SH1 and salt is probably the best way to stay ahead of the hash breakers.

  18. #18
    SitePoint Enthusiast the-webber's Avatar
    Join Date
    Mar 2009
    Posts
    82
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also, I remember a thread on here previously that highly recommended against double hashing because it greatly increases collisions. Stick to the md5 ( password + salt ) method.
    interesting, i myself hadn't heard that. i got the idea from some open source code i once was using.

  19. #19
    SitePoint Evangelist
    Join Date
    Jun 2006
    Location
    Wigan, Lancashire. UK
    Posts
    523
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by the-webber View Post
    interesting, i myself hadn't heard that. i got the idea from some open source code i once was using.
    Double hashing actually increases the probability of collisions... I can look up some mathematical papers on the topic if you're really interested (though it made my head hurt reading them)
    ---
    Development Projects:
    PHPExcel
    PHPPowerPoint

  20. #20
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The salt doesn't need to be secret.
    Suppose you know salt is x_ 33&%# and you have a hash of 827ccb0eea8a706c4c34a16891f84e7b. You can't use an existing rainbow table to get the password. You'd need a rainbow table built specifically with all of it's source passwords salted with x_ 33&%#

    I guess someone could quickly build a table with hashes for salted versions of all the most common passwords but they'd have a much smaller pool. Maybe your app should block insecure passwords like 1234, love etc?
    mikehealy.com.au
    diigital.com art, design . Latest WorkSaturday Morning

  21. #21
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Have your script measure the level of security their password offers, for example make sure the password is case sensitive and contains uppercase and lowercase characters, numbers, some additional characters such as #, @ and ! and is at least 10 characters long. This would dramatically reduce the likelihood of your checksum being brute forced. Also you could add a sort of CAPTCHA verification module where it displays a random shape or something and they have to describe it as “circle”, “square”, “triangle”. Again this would help boost your security though CAPTCHA does decrease the accessibility of your pages which would be a downside.

  22. #22
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    Have your script measure the level of security their password offers, for example make sure the password is case sensitive and contains uppercase and lowercase characters, numbers, some additional characters such as #, @ and ! and is at least 10 characters long. This would dramatically reduce the likelihood of your checksum being brute forced. Also you could add a sort of CAPTCHA verification module where it displays a random shape or something and they have to describe it as “circle”, “square”, “triangle”. Again this would help boost your security though CAPTCHA does decrease the accessibility of your pages which would be a downside.
    No one bruteforces beyond 7 characters. The only way bruteforcing beyond 7 characters would take more than a year in most cases. Besides there are ways to prevent against bruteforcing through apache. So forcing passwords to be 10 characters in length and increasing the number of characters isn't very reasonable.

    Using simple combinatorix you can calculate the number of possible passwords from that are 8 digits in length alpha-numeric and case sensitive. It would take at most (26 x 2 + 10) ^ 7 = 3,521,614,606,208 attempts before being able to exhausts all the possibilities that are 7 characters before you would start on passwords 8 characters in length. The simplest solution is to limit login attempts to 5 attempts per hour.
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  23. #23
    Follow: @AlexDawsonUK silver trophybronze trophy AlexDawson's Avatar
    Join Date
    Feb 2009
    Location
    England, UK
    Posts
    8,111
    Mentioned
    0 Post(s)
    Tagged
    1 Thread(s)
    Yes you are correct, brute force was the wrong thing to suggest the person trying to bypass might do however increasing the password strength and possibly using CAPTCHA (alongside my earlier suggestion of replacing MD5 with SH1) might help strengthen the checksum and salt from being targeted as a simple password and should reduce the likelihood of collisions.

    If anyone wants a good informative listen about checksum security online, Steve Gibson did a great Security Now episode with Leo Laporte on the subject, I can’t offhand remember the episode number but it’s in their archives and free to listen too.

  24. #24
    SitePoint Guru
    Join Date
    Jan 2005
    Location
    heaven
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AlexDawson View Post
    Yes you are correct, brute force was the wrong thing to suggest the person trying to bypass might do however increasing the password strength and possibly using CAPTCHA (alongside my earlier suggestion of replacing MD5 with SH1) might help strengthen the checksum and salt from being targeted as a simple password and should reduce the likelihood of collisions.

    If anyone wants a good informative listen about checksum security online, Steve Gibson did a great Security Now episode with Leo Laporte on the subject, I can’t offhand remember the episode number but it’s in their archives and free to listen too.
    CAPTCHA with a password? No sense in over doing it. Its enough to limit the number of login attempts a person can make in an hour
    Creativity knows no other restraint than the
    confines of a small mind.
    - Me
    Geekly Humor
    Oh baby! Check out the design patterns on that framework!

  25. #25
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,786
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by imaginethis View Post
    CAPTCHA with a password? No sense in over doing it. Its enough to limit the number of login attempts a person can make in an hour
    Even easier is to just reject all login attempts in the 10 or 20 seconds following an invalid or rejected attempt. A brute force approach would then only work if the first guess were the right one unless there were a 15 or 30 second delay in between guesses (resulting in it taking thousands of times longer than it would otherwise have done).
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •