How secure is MD5 and SHA1

[亡魂溺海] 提交于 2021-02-18 11:15:08

问题


Hey just a simple questions, as im tryng to understand a bit more on Hash functions, I know how they work and what they do but how secure are they?

I would appreciate a simple answer not links as I never find them useful.


回答1:


With nowadays technology, both can be cracked. There are also hash dictionaries that help find what a hash means for short strings.

If they are secure or not, highly depends on what you want to protect. If you are building an online banking system, they are not recommended at all (depending where in the online banking system they come to use). If you implement them just for online user password hashing, for example, it also depends on: is you website worth cracking, how many users you have, etc.

A general advice, is to first study the level of security you want to achieve in you scenario and decide what technologies (in this case hashing) you use. There is also no 100% security. Also don't invest too much time into one security issues and ignore others which might not be as obvious or technical (human errors, security by obscurity, human engineering).

Check this out:

  1. generate the hash for a small word here. For example, password has the MD5 hash: 5f4dcc3b5aa765d61d8327deb882cf99
  2. now go here and ask back for the text.

The above example is just one of many (dictionary attack) possible way to crack them. Also the wikipedia articles of each security algorithms gives you a list of vulnerabilities.

ALSO SEE:

  • Is MD5 less secure than SHA et. al. in a practical sense?

SIDE NOTE

Never let websites generate a hash for a real password that you have (in case you need it somewhere for testing or other reasons). Always use test passwords, or generate hashes on your local machine. People building hash databases (hackers or not), also provide online hash tools for capturing hashes.




回答2:


Here is the comparison between MD5 and SHA1. You can get a clear idea about which one is better.




回答3:


When discussing hash security vs brute force shouldn't we take some more in account?

First of all, is md5 obfuscated data stored in trusted zone or not. In other words, do we trust our db admin not to try read user passwords from the database and brute force reverse them. This can be trusted or technically granted via some security procedures (db admin may not have access to the table that stores password hashes, this may be accessible for security officer only).

Another one is possibility of login+password hash pair hijacking from client or client-server transaction. If there's no trojan horse in the client and the communication between client and server is TLS-secured, the pair should be secure from man-in-the-middle attacks.

What is left for the attacker is (apart from social engineering, xss and hosting security break) to subsequently send number of generated requests to the logon server and see if one is successful. This can be managed too:

  • after both successful and unsuccessful login there may be some random lag time before the service responds to slow down brute force process
  • login process may queue parallel login requests from same IP and parallel logins with same login name (to enforce the rule above)
  • there may be limit implemented for unsuccessful logins, after it is exceeded the account is locked and security alert is launched

I believe when above rules are implemented the md5 hash is secure enough. In fact it is equally secure as plain password :) To sum it up if we believe our md5 hash is secure we may simply leave passwords uncovered. The twist is nowadays there is no use of md5 at all (in the matter of password obfuscating). What one should do is leave it plain in the storage in the trusted zone or use some stronger tool (like SHA) when trusted zone is not to be managed. And in my opinion the trusted zone is still under risk of server (hosting service) security break, so no matter of all simply obfuscate the passwords with SHA (or better) :) This shouldn't be costly to harden password hashing itself and it brings some benefits (reduces risks) so my advice is never to revisit this discussion again.

Still even with SHA hashing all the spoken security rules should be implemented. Especially TLS which prevents compromising login+password pair (no matter password is sent plain or hashed with md5 or sha it may enable successful login). Also login attempts should be monitored. Even if we believe our site is brute-force-proof it is good to know someone is trying to break security.



来源:https://stackoverflow.com/questions/16713810/how-secure-is-md5-and-sha1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!