In the last post, I mentioned that I used a purchased wordlist that was 400MB. A good wordlist is the bread and butter for people trying to break passwords offline, and the wordlist rules engine is one of the prime reasons to use JtR. No matter which wordlist you prefer, you should become familiar with the rules engine that JtR has. Using the rules, you can expand each entry of a wordlist to check for different variations of the word. For instance, if your wordlist only contains a single word, "sled", the rules engine might expand that and also check sleds, sled1, sled2, sled!, Sled, and so on. I'll be making one soon that does substitutions with numbers, such as sl1de or sl!de (I would've thought that would be included, but it doesn't seem to be). The rules engine seems to be pretty powerful, but not very well documented, so you may have to play around with it a bit. The rules engine lets you have a relatively small wordlist that expands into a massive one.
When trying to break a Windows password file, there are some weaknesses that you can use to make breaking these passwords much faster if the system stored lanman hashes as well as NTLM hashes. Lanman hashes have a pretty big flaw in them, and by default they're stored in all but the newest versions of Windows. The method used in the lanman hash can only support passwords of up to 14 characters, but the LM hash is actually two hashes. One hash is of the first 7 characters of the password, and the other hash is of the last 7 characters of the password.
When it comes to passwords, longer is better. In fact, every time you add a character to the length of a password, the number of possible passwords grows exponentially. Let's do some math on this. Suppose a password can only contain lowercase letters. Also suppose it can only be three characters long. That means there are 17,576 possible passwords ( 26^3). If we have only four letter passwords, that number grows to 456,976 possible passwords (26^4). Along these same lines, at a password guessing rate of 1,000,000 (very conservative estimate - my parallelized system hits over 100 million easily) passwords guessed per second, it would take a little over two hours to run through every possible password that was seven lowercase characters. If you have two passwords that are seven lowercase characters, even breaking them consecutively would take a little over 4 hours before you would be guaranteed to find the password.
Contrast the four hours it takes to break two seven-character lowercase passwords with the time it will take to break a single fourteen character password at the same guessing rate: 2,051 millenia. So by splitting the fourteen-character password into two seven-character passwords, the time it takes to break is reduced by several orders of magnitude. To make LM hashing even worse, it converts all lowercase letters to uppercase, cutting the potential password alphabet size by 26.
Realistically, to break a lanman hash using one core of my home system using all possible keyboard characters at a length of seven characters would take about two weeks to break, averaging 6,500,000 guesses per second). If you parallelize, you can cut that time down even more. Using all 16 cores on my system, all possible lanman passwords can be tried in one day.
NTLM, on the other hand, hashes the password in it's entirety and will take much longer to break than an LM hash would. However, even if you get the LM hash, this won't let you log in - you still have to find the proper case to match the NTLM hash. For example, suppose the LM password you recover is ICHOOSEPOORLY! for account Administrator. You won't be able to take this use it to log in with Administrator. You'll need to find the correct case somehow. Breaking the NTLM hash may tell you the actual password is IChoosePoorLy!, but as I mentioned, it takes much longer to break NTLM than it does LM.
But, while it does take much longer to break NTLM, it takes very little time to break LM, even in incremental mode. So, what if we broke the LM hash first, giving us the all uppercase password, then used a wordlist with all of the possible upper/lower case combinations. This way you get the password much faster than resorting to incremental mode on the NTLM hash.
Making a list of all of the possible case combinations manually will be very time consuming. You could probably write a script to do it for you, but you don't need to do that. It's already built into JtR. When you specify "--rules" on the john command line, that tells john to look at the section in the john.conf file labeled List.Rules:Wordlist. In the default john.conf file, immediately following that section is another named List.Rules:NT. There are only two rules in this section and they serve only one purpose: For every word in the wordlist, they expand it into every possible combination of upper and lower case.
First, rename the original List.Rules:Wordlist to something else, say List.Rules:Wordlist-original, and then rename List.Rules:NT to be List.Rules:Wordlist (or do as I do and just make a separate john.conf with this already configured). Next, you'll need to create a new wordlist file which will have only one entry - the LM password you broke that is all uppercase. Now if you run john with that wordlist and explicitly tell john to break the NTLM hash using the "--format" option, john will expand the wordlist into all possible case combinations and recover the actual password very quickly.
14 December 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment