Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password attacks 2

Status
Not open for further replies.

silverhairb

IS-IT--Management
Dec 18, 2008
329
0
0
US
Part 1

Background

Passwords are often masked and stored in databases to keep them from being compromised through casual observation. Using MD5 as a masking agent provides a one-way method of creating this masking effect. However, creating the simple MD5 hash of a password does not fully secure it or prevent its compromise. The following is a discussion of the methods employed to mask passwords using hash algorithms, vulnerability of passwords stored in this manner and possible attack scenarios, and a possible solution focused on the Cisco environment.

Data Digest / Hashing

Hashing is a non-reversible cryptographic technique that compresses input data to a fixed length output. The algorithms are designed such that the input to the algorithm cannot be created from the output, but the output can be recreated by using the same input. Even if the length of the input data is different than the length of the output, the output is such that the length of the input data cannot be determined solely by examining the output.

Since the algorithms for hashing data are public, they are easily accessible. Every PC and server use these algorithms routinely for data verification. A MAC is one way of verifying data and is generated using a hash algorithm. Hashes are also used as input for purposes of creating digital signatures over data or as a method of verification such as used in digital certificates. For a given data stream, a hashing algorithm will generate a single fixed value. It seems intuitive that for data input greater than the length of the hash value, some data streams will generate the same hash value, or “collisions”, as others. Good hashing algorithms defeat the ability to predict what circumstances will produce these collisions.

There are several commonly used hash algorithms. These include MD5, SHA-1 and various later generations of SHA. For purposes of this discussion, we will focus on MD5 since it is used in the masking of passwords in Cisco routers.

MD5 (Message Digest number 5) was developed by Ron Rivest of MIT as a hash routine used in the generation of digital signatures using public key cryptography. MD5 generates a 16-byte binary stream most often depicted using hexadecimal or special characters. Several years ago, MD5 was proven mathematically to have a degree of predictability to generating collisions making it undesirable for use in digital signatures. Recent work has shown that using MD5 to generate the hash used in SSL has resulted in undermining the security framework on which SSL relies.

Attack Scenarios

(Recall that for a given data stream, a single repeatable hash value will be produced. Passwords are data streams, typically less than 16 characters long consisting of a mixture of alpha-numeric and special characters.)

It is possible for an attacker to begin to produce a large sample of hash values by running sample cleartext passwords through MD5 and recording the results. This is essentially a “dictionary” of hash values. As the dictionary size increases, passwords generated using MD5 become more susceptible. This dictionary attack is the reason why cryptographic keys used to encrypt PINs in ATMs and point of sale (POS) PIN entry devices are changed regularly. Otherwise, an attacker could begin capturing transactions (with encrypted PINs and debit card mag stripe images) from a device, enter a number of PINs into that device capturing his own transactions and then wait for transactions with encrypted PIN blocks of the same value as the PINs he entered. He would then have a debit transaction with the card’s mag stripe image and the PIN that goes with that card.

Another attack is a simple brute force attack against the password itself as the input value of the hash. This attack is similar to the dictionary attack but is a trial and error attack trying different possible passwords until there is a match to the hash.

The question to be asked about these attacks has to be the effort involved. Hashing uses fairly simple linear math making it relatively streamlined. This makes it efficient in use, like the data encryption algorithm (DEA) commonly known as DES. In 2003 it was estimated that a successful brute force attack against 56-bit single DES would take one hour or less using about $20,000 worth of commonly available PC equipment. Since that time, attack times have diminished with improvements in technology (Moore’s law) and lower prices.

56-bit DES has 2 raised to the power of 56 possible combinations or about 7 quadrillion keys. Given most passwords are less than 16 characters and that there are about 40 characters that are available, the number of possible passwords is about 1000 times that of DES keys. Most passwords use fewer than 10, their values would fit into a dictionary on a PC with a couple of large hard drives. The dictionary could be developed in a matter of hours. This would be used to attack most password hashes.

The more valuable a password, the more money can be spent on the tools needed to successfully discover its value from a known hash. Passwords longer than 16 characters could possibly yield a hash of the same value (collision) as a shorter password diminishing the value of longer passwords and reducing the attack time. If passwords are case-sensitive, attack times would be increased dramatically, but still allow a successful dictionary attack of shorter passwords, and collisions have to be considered a vulnerability to attack.

An important point is that it’s not necessary to actually discover the real password as much as it is necessary to find a combination of data that would generate the same hash value.
 
Part 2

Overcoming attacks on hashed passwords

A possible solution to this problem is to introduce a secret random value that would be XORed (bit-wise exclusive OR) with the password. This value would be used to compute the hash of the password improving the security of the hash. XOR is a bit-wise addition using:
0 + 0 = 0
1 + 0 = 1
0 + 1 = 1
1 + 1 = 0
Using a secret 16-byte random value (a key) XORed with the password would defeat dictionary attacks and would be infeasible in a brute-force attack scenario (much like attacking AES-128). This technique is known as keyed hash or HMAC and is similar to what is used extensively in MasterCard’s “Secure Code” and Visa’s “Verified by Visa” secure ecommerce schemes.

Environmental considerations

The potential solutions are aimed at protecting the value of the exposed hash of the password as displayed in the running configuration. Obviously, concealing the running config would help to keep its passwords secure.
Within a Cisco environment, there are several opportunities to generate and hide such a value. In a small environment, it might be easy enough to generate a 16-byte random and store it flash memory that could not typically be displayed. When the flash is backed-up, the random value would also be retained so that in the event that a recovery of the flash and the running config is required, it could be reloaded into the Cisco platform without concern about password retention.

The password could be backed-up onto a PCMCIA memory card or flash drive to be securely stored. Another more secure option would be to use a smart card to generate and store the 16-byte random value. The card would then generate the hash of the password using the secret 16-byte value. on a secure device such as a smart card, the smart card would then be used for hash generation and be required for login. This would support two-factor authentication that may be desirable in certain sensitive installations.

In a larger environment, it would be more likely that external storage of the 16-byte values would be used so that configurations could be cloned across several devices. Secure management techniques would be employed to secure the storage devices.
 
I decided to stop wordsmithing the h#%% out of the discussion and just post it for consideration. There are probably some things that could be said differently, but I think its technically accurate especially considering the advancements in technology and the cheap processing horsepower we have available.

Its the first thing I've written since I retired, so hopefully it makes a little sense.

[the other] Bill
 
Bill,
Nice and thanks for the info..

Just read in the CCNA Security book that DES would go in three minutes with an attacker budget of $1,000,000! Just thought that I would add that!

Also, MD5 was just broken (able to recreate a valid certificate from trusted CA if MD is used as opposed to SHA1 or RSA!)

Just google "Playstation lab MD5" and you will find it! Apparently the PS3 processor (very good for cryptanalysis) is why they built this 300 PS3 lab! There are some pics out there too! It's sweet!

If you check the CCNA Security forum over at the CLN (Cisco Learning Network) site a friend Conwyn posted some recommended crypto books (may be worth a peek.. he is very good) in the cool books or something similar thread.. It's near the top!

I actually just finished the cryptology chapter of my book so I am going to save a more thorough read of this thread for tomorrow; however, it pretty much falls in line with everything I just read!

B Haines
CCNA R&S, ETA FOI
 
Billy,

If you need a reviewer for your crypto work, let me know. It wouldn't be the first book or paper I've reviewed. I might have even reviewed some of the recommended reading.

BTW, a couple of my old friends think the real DES attack tools would be through the use of some of the nVidia video processors. These are real monsters. The video processors are probably the strength of the PS3 systems and likely the reason they were used.

[the other] Bill
 
Thanks Bill,
I am a long way from writing a book on the subject.. LoL I may take advantage of your services regarding a paper however. I find that writing (which leads to research) tends to be the best method of deeper learning... LoL

I was reading some more on the topic last night and apparently MD5 was first broken in 1996... again in 2005 in a much scarier fashion...

I do have several questions regarding crypto and hashing and will start another thread with them (probably tonight) so any input would be greatly appreciated!

B Haines
CCNA R&S, ETA FOI
 
Bill---dictionary attacks are a given, but I would not call that cracking in the conventional sense of the word. An MD7 password, no matter how many characters and symbols, can be actually cracked in a second or two, using the specific algorithm. Now what about SHA-MAC, the DH method, and 3-DES? 160 bits with 32 random characters...56X3, ya can't beat that! Try generating a hash for that! The only way to hack/crack proof your pc is to unplug it! We all know that!
Also, what do you think about Windows encryption? I have some Maxtor software that encrypts hard drive data better than that, but what is your opinion of Windows Encryption?
One of my favorite things to do is set booby traps on my network, like maybe a honey pot, like an insecure FTP server loaded with viruses/trojans...muahahahahahahaha...lol

Burt
 
Burt,

Maybe my definition of "cracking" is different. That term to me says that a protected value can be exposed outside of the scheme used to protect it.

If SHA-1 is used to generate a hash of the password, it still is vulnerable to dictionary attacks. Keyed hash / HMAC addresses the problem, but, like other cryptographic techniques, relies on securing the key(s) used to generate the cryptogram.

Haven't looked at PC encryption at all. My charge was first, securing ecommerce and public key applications, then later, PIN security.
 
Burt.. The 3DES encryption that you are referring to uses DES (which has been cracked) to EDE (Encrypt/Decrypt/Encrypt). Apparently the inherent flaws in the DES algorithm make it possible to use a weak key with this encryption (albeit unlikely) which will render it much weaker than expected. What I have been reading says that if this encryption is used it is important to test before implementation. Otherwise it is a good choice although still susceptible to brute force (if the attacker has an army of hardware)or potentially a plethora of distributed internet resources.

B Haines
CCNA R&S, ETA FOI
 
Weak DEA keys have been identified and documented. Most DEA routines look for and identify weak keys before they are used.

I don't want to get on yet another soapbox, but 3DES would have been MUCH stronger if they had adopted cypher block chaining (CBC) as I had recommended when we were writing the standards for 3DES modes of operation, and the standards for using 3DES for PIN protection (I think the biggest use of DES-based tools).

Successful attacks against 56-bit DES doesn't reqlly require a lot of hardware as much as it does reasonably fast PCs and some time. Sure it can be done in 3 minutes with $100,000 (or was it $1,000,000) worth of equipment, but it can be done in a few hours on a good gaming system. And you don't have to be Paul Kocher to get it done.

[the other] Bill
 
Its so much easier to just attack the algorithm, management techniques or keys. That stuff drives me crazy.

[the other] Bill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top