I am really enjoying studying currently, and putting in around 10 hours a day 6 days a week.
Ethical hacking and penetration testing require a wide range of skills and knowledge.
Take SQL Injection attacks for example; This is a multilayer attack, where the attacker needs to understand various database queries (MS-SQL, MySQL, Oracle etc) and some scripting languages (PHP, ASP, Perl etc). If the attacker is also going to perform some form of command injection and get a remote administrative shell, they would also need to understand the configuration and capabilities of the web-server, and likely some advanced networking techniques (Windows, Linux, IIS, Apache, advanced use of various TCP tools such as FTP, TFTP, Netcat, inline file transfers etc).
It's lots of fun, but difficult to keep track of everything I am studying, which is why I have just updated my study plan again, at least so that I can keep track of what I have done so far:
http://insidetrust.blogspot.com/2010/10/study-plan-for-next-few-months.html
I am trying to book up exams every month or so, so that I have specific targets to aim for as well.
I passed CEH and Security+ recently, but I found them too easy, so I will be looking to complete some tougher challenges over the next few of months.
I've just started CTP, which is one of the most challenging Penetration and Ethical Hacking courses available.
CTP covers advanced hacking techniques such as developing 0-day exploits, crafting your own custom shellcode, advanced web attacks, reconfiguring border routers to tunnel MITM attacks across the internet, avoiding Anti-virus, back-dooring existing executables, and bypassing new Windows protection mechanisms such as DEP and ASLR.
It will probably take me a while to get through the material ;o)
Monday, 24 January 2011
Friday, 21 January 2011
How to choose better passwords
If you have read some of my previous blogs, you will have an understanding that passwords are a very weak form of authentication, mainly due to the difficulty users have in choosing strong and memorable passwords.
Here I discuss four ways to improve your password choices.
This is the best advice I can give to help people choose stronger passwords.
A bit about poor password choice
Often users choose simple passwords, and use the same password for all their services, both at work and at home. These are both bad ideas.
Simple passwords are easy and fast to crack with widely available automated tools. I know from experience, as I have cracked many passwords recently under test conditions, many in under a second, and certainly most in under 5 minutes.
Using the same password in multiple places means that once a password is compromised on one system, say your home computer, an attacker could then be able to access your work login, your email account, Twitter, Facebook, Youtube, PayPal, eBay, Amazon, and any other online services you use with the same password.
Attackers would not be targeting you personally. Modern malware can automate many hacking techniques and attack many thousands of users at once, globally.
Malicious hacking is big business, and there is a whole criminal subculture geared-up to make money from stollen credentials.
Many people store a lot of information online these days. Imagine if you lost access to your personal accounts and profiles, or worse; someone copied, added or removed information, or sent messages to all your friends containing clever scams or viruses, or transfered some of your money through a series of stolen bank accounts.
So what can users do to choose better passwords?
Having cracked many passwords with a variety of different tools and techniques, here are the four best pieces of advice I can offer.
Now choose similar passwords for your own use.
PS: I use several password dictionaries of commonly used passwords, totalling over 200 million entries.
I find these very effective for password cracking, before attempting hybrid, rainbow-table, and brute-force attacks. They only take a few seconds to run for hash-cracking.
Most of these dictionaries are available on the web if you look, but if you are interested in me providing some copies, let me know in the feedback section.
Here I discuss four ways to improve your password choices.
This is the best advice I can give to help people choose stronger passwords.
A bit about poor password choice
Often users choose simple passwords, and use the same password for all their services, both at work and at home. These are both bad ideas.
Simple passwords are easy and fast to crack with widely available automated tools. I know from experience, as I have cracked many passwords recently under test conditions, many in under a second, and certainly most in under 5 minutes.
Using the same password in multiple places means that once a password is compromised on one system, say your home computer, an attacker could then be able to access your work login, your email account, Twitter, Facebook, Youtube, PayPal, eBay, Amazon, and any other online services you use with the same password.
Attackers would not be targeting you personally. Modern malware can automate many hacking techniques and attack many thousands of users at once, globally.
Malicious hacking is big business, and there is a whole criminal subculture geared-up to make money from stollen credentials.
Many people store a lot of information online these days. Imagine if you lost access to your personal accounts and profiles, or worse; someone copied, added or removed information, or sent messages to all your friends containing clever scams or viruses, or transfered some of your money through a series of stolen bank accounts.
So what can users do to choose better passwords?
Having cracked many passwords with a variety of different tools and techniques, here are the four best pieces of advice I can offer.
- Password length is the most important factor. Try to use a "pass-phrase", i.e. a group of words that is longer than 15 characters.
- This is a sufficient length to make brute-force and hybrid attacks unfeasible with todays computing power.
- Using 15 characters or more also means that the password cannot be stored as an LM hash. (This is one of the weakest forms of password storage, that Microsoft still include on Windows systems today - for historical reasons, but it is a really big weakness)
- Add some numbers and symbols
- Though this does not affect password strength as much as length does, it can be helpful in making your password more unique, by using more of the available key-space.
- Here are some examples
- Friday%is&a4great*day!
- #thisisareallyeasyonetoremember!
- Use different passwords for the accounts you have
- It may be impractical to use a different password for every login to every system, but try to use unique passwords for your core services such as
- Home computer login
- Email access
- Bank accounts
- Work login
- Social networking
- Test your choices, to see if the types of password you are choosing are strong
- Try the Microsoft password strength checker, to get an idea of what makes a password stronger.
- https://www.microsoft.com/protect/fraud/passwords/checker.aspx
- Try putting your current password in. If it comes up "Weak" you're not doing very well with your password choices currently.
- You should be aiming to get at least in the strong category for passwords you use for important accounts.
- See if you can pick a memorable password, that meets the "BEST" category. Try several attempts so you will know what is important in choosing a strong password.
Now choose similar passwords for your own use.
PS: I use several password dictionaries of commonly used passwords, totalling over 200 million entries.
I find these very effective for password cracking, before attempting hybrid, rainbow-table, and brute-force attacks. They only take a few seconds to run for hash-cracking.
Most of these dictionaries are available on the web if you look, but if you are interested in me providing some copies, let me know in the feedback section.
Tuesday, 18 January 2011
CEH and Security+ Certifications
Over the past week I took (and passed) the Security+ and Certified Ethical Hacker (CEH) certifications (two more to add to my increasing list of certs).
Here are my thoughts about both exams.
Certified Ethical Hacker CEH
This was reasonably good exam, and passing it shows that you know something about IT Security in relation to hacking and countermeasures.
I found this exam easier than I expected (but having been on the Pentesting with Backtrack course, I guess anything in this field would seem easier).
The most interesting questions were around interpreting logs of hacker activity, and assessing what had been done or attempted. Having actually performed these attacks myself, I found it straight-forward, but interesting.
(I finished the exam in around half the time allowed, with a high passing score)
What does CEH prove?
What doesn't it measure that I feel it should
I would say this exam is focused more towards incident response teams rather than ethical hackers or penetration testers, but I enjoyed it, and would say that it was worth taking.
Security+
This exam was disappointing as I found it far too easy. Very much an entry level exam.
What does it prove?
What doesn't it measure that I feel it should
My recommended certs
For all the exams, courses and certifications I have taken so far, I would most recommend the following based on their difficulty, value to a company, and ability to measure a person's skills and knowledge.
Here are my thoughts about both exams.
Certified Ethical Hacker CEH
This was reasonably good exam, and passing it shows that you know something about IT Security in relation to hacking and countermeasures.
I found this exam easier than I expected (but having been on the Pentesting with Backtrack course, I guess anything in this field would seem easier).
The most interesting questions were around interpreting logs of hacker activity, and assessing what had been done or attempted. Having actually performed these attacks myself, I found it straight-forward, but interesting.
(I finished the exam in around half the time allowed, with a high passing score)
What does CEH prove?
- A reasonable knowledge for attack vectors, and some tools (though you don't need to be an expert hacker by any means)
- Knowledge of command line options, and interpretation of output, for various tools including
- tcpdump
- snort
- nmap
- hping
- Understanding of various reconnaissance and scanning methods
- Knowledge of several hacking techniques and methodologies
- A good working knowledge of Wireshark and networking protocols
- An understanding of DoS, rootkits and trojans
What doesn't it measure that I feel it should
- Ability to use these tools in a real world environment
- Ability to perform a penetration test, or defend a network
I would say this exam is focused more towards incident response teams rather than ethical hackers or penetration testers, but I enjoyed it, and would say that it was worth taking.
Security+
This exam was disappointing as I found it far too easy. Very much an entry level exam.
What does it prove?
- A very general understanding of basic IT Security principles and networking protocols
- Not sure other than that...
What doesn't it measure that I feel it should
- Far too much to mention (I really don't think it measured my skills or challenged me)
I'm not sure who this exam is aimed at, perhaps IT staff who are taking their first steps into IT Security.
In Summary
CEH is a reasonable exam to prove a basic understanding in incident response, hacking, and network security. I would say this exam is worth taking, though certainly not as in-depth as something like OSCP or CREST.
As for Security+: If you are thinking of taking, or hiring anyone based on Security+; I would say look at other certs as this one is very much entry level.
My recommended certs
For all the exams, courses and certifications I have taken so far, I would most recommend the following based on their difficulty, value to a company, and ability to measure a person's skills and knowledge.
- CISSP - For a very broad reaching view of IT Security
- OSCP - For it's technical depth, and understanding of attackers
- CISM - To help match IT Security to the needs, and risk tolerance, of a business
Monday, 10 January 2011
Password cracking: Using John The Ripper (JTR) to detect password case (LM to NTLM)
When password-cracking Windows passwords (for password audits or penetration testing) if LM hashing is not disabled, two hashes are stored in the SAM database.
The first is the LM hash (relatively easy to crack because of design flaws, but often stored for backwards-compatibility)
The second is the NTLM hash which can be more difficult to crack (when used with strong passwords).
LM hashes store passwords all uppercase, and split into 2 blocks of 7 bytes (which is part of the reason why they are so weak).
This makes LM hashes easy to crack (complete rainbow tables of all possible hashes can be easily obtained for super-fast cracking).
However, cracking the LM hash does not tell you the full story about the password, i.e. you won't know the case of the alphabetic characters in the password. The passwords could be all uppercase, all lowercase, or a mixture and finding the case of the passwords can be important.
Here I will show how to crack the LM hashes and use these to find the exact password from the NTLM hashes.
Please remember to use these techniques only for legitimate educational and testing purposes and not maliciously.
The hashes
For these tests, I first set up a test Windows XP machine and added six users with various passwords, some of which you may think would be strong, but they are not strong enough!
I extract the passwords from the SAM using fgdump.exe, and get the following:
bert:1011:5DF12C9F2162249EAAD3B435B51404EE:099C037B843FDCA6489B03635E87EA76:::
erik:1008:4E1FB9BDD16A8F51AAD3B435B51404EE:FDC342B83B8A552C742B013E8A1BCA99:::
ernie:1012:1B638DBD583CF83D64BBD09A598E07AD:01C4EA2C58B2A0326D5EDF613E60DCED:::
jack:1015:F41D0D9F9038C51884672E50BA7FB014:14EAE3724A706F637FFC150A085F6EB3:::
phil:1009:208752DBBBEC625EAAD3B435B51404EE:9762FAD5394D489BFD7F662E9BC13655:::
sam:1010:FA1961430A96F9BEAAD3B435B51404EE:53F0FAE7D53BBE6C90F843ECEB71DCA0:::
So in the following example this is the LM hash, and this is the NTLM hash.
bert:1011:5DF12C9F2162249EAAD3B435B51404EE:099C037B843FDCA6489B03635E87EA76:::
I have put these hashes in a file called crackmemixed.txt on a Backtrack 4 system in /pentest/passwords/jtr.
Cracking the LM hashes
We will be using John The Ripper, so first type
john
To crack the LM hashes it is always worth trying a dictionary attack first, as this is very fast, so I will use the following command:
./john --wordlist=/pentest/passwords/wordlists/bt4-password.txt crackmemixed.txt
Loaded 12 password hashes with no different salts (LM DES [128/128 BS SSE2])
HAPPY (erik)
OW (ernie:2)
SHOWMEN (ernie:1)
GRRRRRE (jack:1)
WIBBLE (sam)
guesses: 5 time: 0:00:00:00 100.00% (ETA: Mon Jan 10 10:13:33 2011) c/s: 26204K trying: ZZAJ - {LOG}
This used over three million passwords, took less than a second and cracked some of the hashes. (For LM hashes, the passwords longer than 7 characters are crack in two 7 byte pieces)
There are a few more hashes to crack so we will let JTR do a brute-force attack on the rest:
./john --format=lm crackmemixed.txt
Loaded 3 password hashes with no different salts (LM DES [128/128 BS SSE2])
AT! (jack:2)
FLUFF34 (phil)
4REF5 (bert)
guesses: 3 time: 0:00:00:18 (3) c/s: 19370K trying: 4RIIN - 4RO5A
So we are all done with the LM hashes in under 20 seconds (which is pretty good). For stronger passwords, if this method was taking longer than a few minutes, I would probably would move to LM hash rainbow tables next, which would speed things up a lot.
Check our LM hash-cracked passwords
To display what we have so for we can do
./john -show crackmemixed.txt
bert:4REF5:1011:::
erik:HAPPY:1008:::
ernie:SHOWMENOW:1012:::
jack:GRRRRREAT!:1015:::
phil:FLUFF34:1009:::
sam:WIBBLE:1010:::
8 password hashes cracked, 0 left
... but as you can see, this is all all displayed in uppercase, as we can't tell the case of the passwords from cracking the LM hashes.
Preparing for cracking the NTLM hashes
We are going to change the rules that JTR uses, so will will make two backups of the rules file:
Then edit the rules file, as follows:
Our NTLM hashes
To show the NTLM hashes we are trying to crack use:
sam:$NT$53f0fae7d53bbe6c90f843eceb71dca0
phil:$NT$9762fad5394d489bfd7f662e9bc13655
jack:$NT$14eae3724a706f637ffc150a085f6eb3
ernie:$NT$01c4ea2c58b2a0326d5edf613e60dced
erik:$NT$fdc342b83b8a552c742b013e8a1bca99
bert:$NT$099c037b843fdca6489b03635e87ea76
Cracking our NTML hashes
First we need to create a dictionary file which will contain just the passwords we have already obtained from LM hash-cracking, with the following command:
./john --show --format=LM crackmemixed.txt | grep -v "password hashes" | cut -d":" -f2 | sort -u > lmcracked.txt
So we now have a list of just the passwords in uppercase in lmcracked.txt. Let's put our special password rules in place:
cp john.conf.ntlm john.conf
Now we can using our specific password dictionary and rules to crack the NTLM password hashes as follows:
./john -rules --wordlist=lmcracked.txt --format=nt crackmemixed.txt
Loaded 6 password hashes with no different salts (NT MD4 [128/128 SSE2 + 32/32])
4Ref5 (bert)
HaPpY (erik)
fluff34 (phil)
wibble (sam)
GRRRRReat! (jack)
ShowMeNow (ernie)
guesses: 6 time: 0:00:00:00 100.00% (ETA: Mon Jan 10 11:24:44 2011) c/s: 44800 trying: GrrrRREAt! - sHOWMEnow
This took less than a second, and we have cracked the case sensitive NTLM hashes from the case insensitive LM hash-cracked passwords.
Returning JTR rules back to normal
After you are done, don't forget to put the rules back how they were:
cp john.conf.old john.conf
Mitigation
End to end, this exercise could have been done in under a minute. This just goes to show how weak passwords can be, and how easily they can be cracked with the right tools, network access and knowhow.
The first is the LM hash (relatively easy to crack because of design flaws, but often stored for backwards-compatibility)
The second is the NTLM hash which can be more difficult to crack (when used with strong passwords).
LM hashes store passwords all uppercase, and split into 2 blocks of 7 bytes (which is part of the reason why they are so weak).
This makes LM hashes easy to crack (complete rainbow tables of all possible hashes can be easily obtained for super-fast cracking).
However, cracking the LM hash does not tell you the full story about the password, i.e. you won't know the case of the alphabetic characters in the password. The passwords could be all uppercase, all lowercase, or a mixture and finding the case of the passwords can be important.
Here I will show how to crack the LM hashes and use these to find the exact password from the NTLM hashes.
Please remember to use these techniques only for legitimate educational and testing purposes and not maliciously.
The hashes
For these tests, I first set up a test Windows XP machine and added six users with various passwords, some of which you may think would be strong, but they are not strong enough!
I extract the passwords from the SAM using fgdump.exe, and get the following:
bert:1011:5DF12C9F2162249EAAD3B435B51404EE:099C037B843FDCA6489B03635E87EA76:::
erik:1008:4E1FB9BDD16A8F51AAD3B435B51404EE:FDC342B83B8A552C742B013E8A1BCA99:::
ernie:1012:1B638DBD583CF83D64BBD09A598E07AD:01C4EA2C58B2A0326D5EDF613E60DCED:::
jack:1015:F41D0D9F9038C51884672E50BA7FB014:14EAE3724A706F637FFC150A085F6EB3:::
phil:1009:208752DBBBEC625EAAD3B435B51404EE:9762FAD5394D489BFD7F662E9BC13655:::
sam:1010:FA1961430A96F9BEAAD3B435B51404EE:53F0FAE7D53BBE6C90F843ECEB71DCA0:::
So in the following example this is the LM hash, and this is the NTLM hash.
bert:1011:5DF12C9F2162249EAAD3B435B51404EE:099C037B843FDCA6489B03635E87EA76:::
I have put these hashes in a file called crackmemixed.txt on a Backtrack 4 system in /pentest/passwords/jtr.
Cracking the LM hashes
We will be using John The Ripper, so first type
john
To crack the LM hashes it is always worth trying a dictionary attack first, as this is very fast, so I will use the following command:
./john --wordlist=/pentest/passwords/wordlists/bt4-password.txt crackmemixed.txt
Loaded 12 password hashes with no different salts (LM DES [128/128 BS SSE2])
HAPPY (erik)
OW (ernie:2)
SHOWMEN (ernie:1)
GRRRRRE (jack:1)
WIBBLE (sam)
guesses: 5 time: 0:00:00:00 100.00% (ETA: Mon Jan 10 10:13:33 2011) c/s: 26204K trying: ZZAJ - {LOG}
This used over three million passwords, took less than a second and cracked some of the hashes. (For LM hashes, the passwords longer than 7 characters are crack in two 7 byte pieces)
There are a few more hashes to crack so we will let JTR do a brute-force attack on the rest:
./john --format=lm crackmemixed.txt
Loaded 3 password hashes with no different salts (LM DES [128/128 BS SSE2])
AT! (jack:2)
FLUFF34 (phil)
4REF5 (bert)
guesses: 3 time: 0:00:00:18 (3) c/s: 19370K trying: 4RIIN - 4RO5A
So we are all done with the LM hashes in under 20 seconds (which is pretty good). For stronger passwords, if this method was taking longer than a few minutes, I would probably would move to LM hash rainbow tables next, which would speed things up a lot.
Check our LM hash-cracked passwords
To display what we have so for we can do
bert:4REF5:1011:::
erik:HAPPY:1008:::
ernie:SHOWMENOW:1012:::
jack:GRRRRREAT!:1015:::
phil:FLUFF34:1009:::
sam:WIBBLE:1010:::
8 password hashes cracked, 0 left
... but as you can see, this is all all displayed in uppercase, as we can't tell the case of the passwords from cracking the LM hashes.
Preparing for cracking the NTLM hashes
We are going to change the rules that JTR uses, so will will make two backups of the rules file:
cp john.conf john.conf.old
cp john.conf john.conf.ntlm
Then edit the rules file, as follows:
- In john.conf.ntlm
- Replace "List.Rules:Wordlist" with "List.Rules:Disabled" to disable the normal ruleset
- Then replace "List.Rules:NT" with "List.Rules:Wordlist" to enable our specialised attack
Our NTLM hashes
To show the NTLM hashes we are trying to crack use:
./john --show=LEFT --format=NT crackmemixed.txt
sam:$NT$53f0fae7d53bbe6c90f843eceb71dca0
phil:$NT$9762fad5394d489bfd7f662e9bc13655
jack:$NT$14eae3724a706f637ffc150a085f6eb3
ernie:$NT$01c4ea2c58b2a0326d5edf613e60dced
erik:$NT$fdc342b83b8a552c742b013e8a1bca99
bert:$NT$099c037b843fdca6489b03635e87ea76
Cracking our NTML hashes
First we need to create a dictionary file which will contain just the passwords we have already obtained from LM hash-cracking, with the following command:
./john --show --format=LM crackmemixed.txt | grep -v "password hashes" | cut -d":" -f2 | sort -u > lmcracked.txt
So we now have a list of just the passwords in uppercase in lmcracked.txt. Let's put our special password rules in place:
cp john.conf.ntlm john.conf
Now we can using our specific password dictionary and rules to crack the NTLM password hashes as follows:
./john -rules --wordlist=lmcracked.txt --format=nt crackmemixed.txt
Loaded 6 password hashes with no different salts (NT MD4 [128/128 SSE2 + 32/32])
4Ref5 (bert)
HaPpY (erik)
fluff34 (phil)
wibble (sam)
GRRRRReat! (jack)
ShowMeNow (ernie)
guesses: 6 time: 0:00:00:00 100.00% (ETA: Mon Jan 10 11:24:44 2011) c/s: 44800 trying: GrrrRREAt! - sHOWMEnow
This took less than a second, and we have cracked the case sensitive NTLM hashes from the case insensitive LM hash-cracked passwords.
Returning JTR rules back to normal
After you are done, don't forget to put the rules back how they were:
cp john.conf.old john.conf
Mitigation
End to end, this exercise could have been done in under a minute. This just goes to show how weak passwords can be, and how easily they can be cracked with the right tools, network access and knowhow.
- Disable LM hashes
- Implement a strong password policy
- Check this is enforced and working correctly with regular audits
Subscribe to:
Posts (Atom)


