Solved

Using triple DES with a linux password file

Posted on 2001-08-01
12
762 Views
Last Modified: 2013-12-16
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
0
Comment
Question by:bluezen
12 Comments
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6340597
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
 
LVL 1

Author Comment

by:bluezen
ID: 6348058
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
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6348544
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
 
LVL 1

Author Comment

by:bluezen
ID: 6355259
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
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6356139
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
 
LVL 1

Author Comment

by:bluezen
ID: 6360712
Actually Im really looking for existing implementations...there might be something really stupid I miss otherwise.

bluezen
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 40

Expert Comment

by:jlevie
ID: 6375626
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
 
LVL 1

Author Comment

by:bluezen
ID: 6381253
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
 
LVL 14

Accepted Solution

by:
chris_calabrese earned 100 total points
ID: 6381383
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
 
LVL 14

Expert Comment

by:chris_calabrese
ID: 6381391
Oops, that first Because is obviously misplaced in the previous post.
0
 
LVL 9

Expert Comment

by:majorwoo
ID: 8433089
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
 

Expert Comment

by:SpideyMod
ID: 8617630
per recommendation

SpideyMod
Community Support Moderator @Experts Exchange
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now