Using triple DES with a linux password file

Hello,

I want to implement triple DES in my Redhat Linux 7.0 password file encryption, instead of the standard DES. Does anybody have any resources / libraries which make this possible ?

Thanks
bluezen
LVL 1
bluezenAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
chris_calabreseConnect With a Mentor Commented:
Because the system doesn't simply pass something to DES but first combines a text password with a salt and uses it as a sort of combination key/plaintext to generate the hash.

So, cracking a UNIX password involves either finding the original password, or finding another password that combines with the same salt to generate the same hash.

Yes, the 40 bit keylength of DES implies that it's more likely that you could find another password that works than with 3DES, but there's no simple alghorithm to break the "key" and then produce a workable password.  You have to brute force through the entire realm of password choices, combine them with the salts, and then hash them.  That means you can't use a general-purpose DES cracking system (such as TINKLE or something).  Also, given the small amount of information in the average password, it's likely that there aren't any such collisions anyway, even with 40 bit DES, so you really have to find the original password, in which case it doesn't matter if you have a 40 bit algorithm or a 4000000 bit algorithm.
0
 
chris_calabreseCommented:
Presumably to make it harder to obtain the key from a brute-force attack.  But this is a non-issue for password storage.

The way the password system works is that the cypher is modified so that instead of working as a regular encryptor/decryptor, it can only encrypt, and not decrypt.  This is called cryptographic hashing, or one-way hashing.

To test whether a particular password is correct, you encrypt/hash the password presented by the user with a small key  called a salt that's stored with the hashed password in the password database.  Then you compare the newly generated hashed result with the one stored in the password database.  If they're they same, the password is correct.  If not, it's incorrect.

The salt is there to make it harder to pre-encrypt/hash a dictionary of popular passwords since you'd have to pre-encrypt/hash the dictionary for each salt value.

So.....  Going to tripple-des won't actually help any.
0
 
bluezenAuthor Commented:
Im aware of how standard password encryption works. Pretty well actually ;)


However, I want to enforce Triple DES to make bruteforcing using the dictionary method...basically slowing things up.

So Id like some info on it.
Thanks
bluezen
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
chris_calabreseCommented:
If slowness is what you're after, what about MD5?  I'm not really a Penguin head, but I understead that it's easy enough to use MD5 in the linux password database (hmm, maybe that was OpenBSD I  was thinking about, though).
0
 
bluezenAuthor Commented:
Yup that it is, but Im really interested in triple DES...Ive worked with MD5 a bit, I really want to try triple DES.

0
 
chris_calabreseCommented:
Well, in that case I suggest you start with the source code to your favorite Linux distro, start looking at the source to login, and figure out what's happening from there.  And don't forget your copy of Applied Cryptography, since you first have to build a MAC function from 3des, which in itself won't be easy.
0
 
bluezenAuthor Commented:
Actually Im really looking for existing implementations...there might be something really stupid I miss otherwise.

bluezen
0
 
jlevieCommented:
I don't think you are going to find an existing 3des password implementation and will have to write your own (at least I've never heard of a 3des password implementation). I suspect that if I were going to do something like that, I'd consider writing an pam module to do SASL authentication and write a 3des mech for SASL. At least that way you'd be able to fully test your 3des method before commiting the system to using it and possbily locking yourself out.

When considering alternative encryption methods for passwords, remember that the method has to be able to generate the encrypted password string for the plaintext password for compairsion. With DES passwords that's pretty easy. Use the first two characters of the encrypted password as the salt and feed that and the plaintext to the DES routine. Out will pop the encrypted string which will match if and only if the plaintext password is correct. MD5, CRAM, & DIGEST have similar mechanisms. Consider the essential elements of a password encryption method, which are:

1) The encryption must be one-way.  There should be no way to decrypt an encrypted password string.

2) The process of generating the encrypted string from the plaintext must be 100% repeatable when checking passwords.

3) Generated encryption strings must not be unique. I.E., encrypting the same plaintext password multiple times must yield a different encryption string when generating the string to be stored in the authentication database.

So if you want to 'roll your own' you should keep the above in mind. And also consider that the best password encryption method possible is nearly worthless unless good security practices are in use, like only allowing encrypted sessions when users must be authenticated, protecting the password database from prying eyes, and ensuring that all passwords are good (at least 8 random characters) and that they get changed regularly. And of course keeping a system completely up to date w/respect to security fixes is essential.
0
 
bluezenAuthor Commented:
Hmm yeah most of what you say makes sense, and I definitely wouldnt implement the system till I tried it out myself.

I wonder though, if somebody (long long ago) did modify DES to use with the unix password file encryption, how come they havent done the same with 3des (especially in view of the fact that industrial grade machines can be built to decrypt (not crack, but decrypt) DES regular.

bluezen
0
 
chris_calabreseCommented:
Oops, that first Because is obviously misplaced in the previous post.
0
 
majorwooCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area to:
Accept chris_calabrese's answer
Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
majorwoo
EE Cleanup Volunteer
0
 
SpideyModCommented:
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0
All Courses

From novice to tech pro — start learning today.