-   Linux - Security (
-   -   MD5 password exposed (

Fredde87 06-07-2010 06:51 AM

MD5 password exposed

I noticed that our /etc/shadow file is readable on a patch I released for one of our in house linux boxes a while back ago.

If someone was cleaver enough and managed to see it, could they use it to gain access the root account etc? Our passwords are all MD5 encrypted.


ilikejam 06-07-2010 07:46 AM


Yes, it is possible to de-hash the passwords in /etc/shadow . There are programs (John the Ripper being the most-used on Unix) which can use dictionary and brute-force attacks against the hashes, and will eventually hit the right password.

I would change the permissions if I were you.


Fredde87 06-07-2010 09:18 AM

Hi there,

Sorry, should have been a bit clearer. With exceptions of brutal force, database lookups etc, is there a way the user could use the encrypted password and send it to a ssh server for example? The password the user types in is encrypted with MD5 before sent to the ssh server isn't it? So a user could modify a SSH client potentially to send me string to the ssh server to get in as root?

Best Regards


ilikejam 06-07-2010 09:24 AM


SSH encrypts the whole stream and the password is passed down that encrypted channel, but it's not MD5 that's used (MD5 isn't an encryption algorithm, it's just a hash). The password (along with everything else) is decrypted by the SSH server before being used - most Linuxen use PAM to process authentication, so the password's passed to PAM in plaintext to be compared with the hash in /etc/shadow.

So no, having the MD5 hash on it's own won't let anyone in.


Fredde87 06-07-2010 09:56 AM

Thanks for clarifiying that!

anomie 06-08-2010 05:22 PM

Nevertheless, I'll second the recommendation that you 1) fix the permissions on /etc/shadow; 2) consider changing root's password very soon.

With today's computing power (even on affordable workstations), someone with the salt + MD5 hash can realistically discover your password.

All times are GMT -5. The time now is 05:22 AM.